Dragonfly Bis

37 views
Skip to first unread message

Gloufy

unread,
Jul 24, 2015, 7:25:35 AM7/24/15
to ActiveScaffold : Ruby on Rails Gem
Hi
On update, my form is doesn't send when i don't change the dragonfly file.
In console i have : 
An invalid form control with name='record[portrait]' is not focusable.
edit:1 An invalid form control with name='record[pied]' is not focusable.

What does that mean ?

Gloufy

Sergio Cambra

unread,
Jul 28, 2015, 3:21:28 AM7/28/15
to actives...@googlegroups.com, Gloufy

Probably it's a hidden field, which have wrongly required attribute. Can you check that with inspector?

Gloufy

unread,
Dec 24, 2015, 6:15:06 AM12/24/15
to ActiveScaffold : Ruby on Rails Gem, cedric.m...@gmail.com
Yes ! :
<input value="false" type="hidden" name="record[remove_portrait]" id="record_remove_portrait"> but no required attribute..

Sergio Cambra

unread,
Dec 24, 2015, 6:25:06 AM12/24/15
to actives...@googlegroups.com, Gloufy
Re-read and I think not focusable errors are logged when form is loaded,
trying to focus first field, not related to submit. Check network tab in
inspector, is there a request for submit? If not, check fields with required
attribute.

Gloufy

unread,
Dec 24, 2015, 6:40:07 AM12/24/15
to ActiveScaffold : Ruby on Rails Gem, cedric.m...@gmail.com
exactly ! no errors on loading form just when i'm clicking on update button,
in tab inspector i didn't find a request for a submit, without click update button and click update button.
but if i put this on the helper it's work : 

def active_scaffold_input_options(column, scope = nil, options = {})    

opts = super

    if (column.name.to_s=="portrait" and !@record.portrait.blank?) or (column.name.to_s=="pied" and !@record.pied.blank?)

      opts.delete(:required)

    end

    opts

  end 

Sergio Cambra

unread,
Dec 24, 2015, 7:03:16 AM12/24/15
to actives...@googlegroups.com, Gloufy
What are validations on your model?

Gloufy

unread,
Dec 24, 2015, 7:26:46 AM12/24/15
to ActiveScaffold : Ruby on Rails Gem, cedric.m...@gmail.com

  validates_property :format, of: :portrait, in: ['jpeg','jpg', 'png', 'gif'],message: "Le format de la photo portrait doit être : .jpeg, .jpg, .png, .gif",:on => :create

  validates_property :format, of: :pied, in: ['jpeg','jpg', 'png', 'gif'],message: "Le format de la photo pied doit être : .jpeg, .jpg, .png, .gif",:on => :create

validate do

 

    errors.add(:portrait, "Il faut une photo portrait") if self.portrait.blank?

    errors.add(:pied, "Il faut une photo en pied") if self.pied.blank?


  end

Sergio Cambra

unread,
Dec 24, 2015, 7:42:06 AM12/24/15
to actives...@googlegroups.com, Gloufy
I don't see why it's adding required to file input fields, there is no
validates_presence_of for them

Gloufy

unread,
Dec 24, 2015, 12:23:03 PM12/24/15
to ActiveScaffold : Ruby on Rails Gem, cedric.m...@gmail.com
sorry i forget to copy that :   
validates_presence_of :portrait,

     :pied

Sergio Cambra

unread,
Dec 29, 2015, 9:55:35 AM12/29/15
to actives...@googlegroups.com, Gloufy
I have fixed on 3.4.32

Gloufy

unread,
Jan 4, 2016, 3:56:07 AM1/4/16
to ActiveScaffold : Ruby on Rails Gem, cedric.m...@gmail.com
you rocks ! thank you and happy new year !

Gloufy

unread,
Jan 7, 2016, 11:21:17 AM1/7/16
to ActiveScaffold : Ruby on Rails Gem, cedric.m...@gmail.com
last question !
when in the action "list" 
one picture doesn't be on the hard disk for X reason, in production mode i'v a error, because dragonfly doesn't find the file, i just want to show nothing if there are not a picture instead  a big error which crash the "application"
how to do that ?

Sergio Cambra

unread,
Jan 8, 2016, 4:19:02 AM1/8/16
to actives...@googlegroups.com, Gloufy
Probably you can override active_scaffold_column_dragonfly and rescue
exception:

def active_scaffold_column_dragonfly(record, column)
super
rescue
return something for error (or nothing)
end

Gloufy

unread,
Jan 23, 2016, 5:42:22 AM1/23/16
to ActiveScaffold : Ruby on Rails Gem, cedric.m...@gmail.com
hi, 
little problem
some times in the list controller the thumbnail of the pic is not in the right 'rotation' or the pic is good when i click behin do you know why ?
Gloufy

Gloufy

unread,
May 22, 2017, 9:12:48 AM5/22/17
to ActiveScaffold : Ruby on Rails Gem, cedric.m...@gmail.com
Hi Sergio

Where I can override active_scaffold_column_dragonfly ? which file ?

Thank you for your response

Gloufy

Gloufy

unread,
May 22, 2017, 9:15:46 AM5/22/17
to ActiveScaffold : Ruby on Rails Gem, cedric.m...@gmail.com
in the application_helper !!! I found it ! sorry
Reply all
Reply to author
Forward
0 new messages