If you want to select a value automatically, in after_render_field method in 
controller, 
set the value on the model (value for PARIS line in this case)

El Lunes, 2 de noviembre de 2015 15:19:12 Gloufy escribió:
> Hi back,
> 
> How to select after a update_colums/options_for_association_conditions a
> "line" in my selectbox.
> For example the result in my selectbox i have :
> - select a city
> - PARIS
> If my selectbox have more that "select a city" i want to select PARIS
> directly
> How i can do that ?
> thank you
> Gloufy
> 
> Le mercredi 3 juin 2015 13:45:52 UTC+2, Sergio Cambra a écrit :
> > You would have to set form_ui = :hidden on after_render_field (controller
> > method). If you do that you should set form_ui on do_edit and do_new also
> > (or before_filter :set_column_form_ui, :only => [:new, :create, :edit,
> > 
> > :update])
> > 
> > Also you can override field_attributes(column, record) helper to set a
> > class (it will be used on dl tag) then you can hide with css.
> > 
> > 
> > 
> > def field_attributes(column, record)
> > 
> > if conditions_to_hide_column
> > 
> > {:class => '...'}
> > 
> > else
> > 
> > super
> > 
> > end
> > 
> > end
> > 
> > El Martes, 2 de junio de 2015 09:51:15 Gloufy escribió:
> > > it's work perfectely ! thanks you so much !
> > > 
> > > Last question how to hide or show a field after a update_columns ?
> > > 
> > > Le mardi 2 juin 2015 17:33:49 UTC+2, Sergio Cambra a écrit :
> > > > That code won't load any city, because record.postal_code would be
> > > > nil.
> > > > 
> > > > 
> > > > 
> > > > Really it would load cities with no postal code, but I'm guessing
> > > > every
> > > > 
> > > > would have a postal code
> > > > 
> > > > El Martes, 2 de junio de 2015 08:22:28 Gloufy escribió:
> > > > > thank you ! and for the city i have :
> > > > > 
> > > > > 
> > > > > 
> > > > > config.columns[:city].form_ui = :select
> > > > > 
> > > > > 
> > > > > 
> > > > > how to begin with options for the select with none record (because
> > 
> > i've
> > 
> > > > > 36000 cites in the database)
> > > > > 
> > > > > 
> > > > > 
> > > > > i just want a list in the select when zip code is not null...
> > > > > 
> > > > > Le mardi 2 juin 2015 17:03:44 UTC+2, Sergio Cambra a écrit :
> > > > > > Define options_for_association_conditions:
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > def options_for_association_conditions(association, record)
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > if association.name == :city
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > {:postal_code => record.postal_code}
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > else
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > super
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > end
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > end
> > > > > > 
> > > > > > 

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/activescaffold.
For more options, visit https://groups.google.com/d/optout.

Reply via email to