I have this collection_select usage in my view:
<%= collection_select(:production_year, :id, @car_models, :id, :name, { :prompt => "Year" }, { :disabled => "disabled" } ) %>
But it seems, that i'll add much logic for this select box. So i want pass parameters for this collection_select from my controller. How can i do this?
Was trying to pass array with parameters, but got many errors. Pls show correct way for this.
In your controller: @collection_select_params = [ ... ]
And in your view: <%= collection_select(*@collection_select_params) %>
The *
prefix will indicate to ruby that this array is to be passed as an args list.