Answer by Max Williams for How can set a default value in select tag?
One thing to bear in mind is that if params[:customer_id] isn't there, then it will be equal to nil, and nil.to_i gives 0. This should be fine as you shouldn't have a customer with id 0 but it's...
View ArticleAnswer by David Underwood for How can set a default value in select tag?
@customer_selected is an array, as the error states. This is because find(:all) returns an array, even if there is only one result.You should be able to replace@customer_selected =...
View ArticleHow can set a default value in select tag?
I have a table and want to set default valueHere is the table:|customers| |id| |name| 1 ABC 2 DEF 3 GHI 4 JKLHere is the controller:@customers.Customer.all@customer_selected =...
View Article