↧
Answer by robe007 for Define the default value of a drop down menu from a...
According to the documentation about options_for_select, the second parameter is the selected value:options_for_select(container, selected = nil)So, the answer according to my question is:<%=...
View ArticleAnswer by Deem for Define the default value of a drop down menu from a class...
You can define the default value by using the :selected option:<%= s.select :category, :selected => params[:id] %>
View ArticleDefine the default value of a drop down menu from a class variable
I have a list of books categories on my db. I can get the value of them inside my controller like this:@categories = Book.uniq.pluck(:category) #programming, networking, infrastructureAnd then, I can...
View Article