Quantcast
Channel: How can set a default value in select tag? - Stack Overflow
Browsing latest articles
Browse All 3 View Live

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 Article



Answer 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 Article

How 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
Browsing latest articles
Browse All 3 View Live


Latest Images