Thursday, 26 September 2013

How to retrieve user's input of label in drop down list in rails 3.2?

How to retrieve user's input of label in drop down list in rails 3.2?

The following simple form takes user input with a drop down list of zone.
The zone_id of user input could be retrieved with
params[:controller][:zone_id].
<%=f.input :zone_id, :label => t('Zone'), :collection =>
Zone.where(:active => true).order('ranking_order'), :label_method =>
:zone_name, :value_method => :id, :include_blank => true %>
In our rails 3.2 app however, we also need to retain the label of user's
input which is zone_name here. Is there a way to retrieve label
(zone_name) of user's input in controller? Thanks.

No comments:

Post a Comment