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

java - How to pass parameters between Request-Scoped Controllers? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -

ms access - C# - Using OleDbParameter on table name -