ruby - rails simple_form_for association select text -



ruby - rails simple_form_for association select text -

i using rails 3.0, ruby 1.9.2 , plataformatec simple_form gem.

the code below renders select box consumer names. want show select box consumer locations instead. how do that?

view code:

<%= simple_form_for @request |f| %> <%= f.association :consumer, :collection => consumer.all, :prompt => "choose location" %> <%= f.button :submit %> <% end %>

model code:

consumer < activerecord::base attr_accessor :name, :location end

you via label_method

<%= f.association :consumer, :collection => consumer.all, :prompt => "choose location", :label_method=>:location %>

ruby-on-rails ruby simple-form

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -