I can't seem to find the syntax to add a class to a select tag generated by Rails collection_select
. Some help?
相关问题
- Views base64 encoded blob in HTML with PHP
- Question marks after images and js/css files in ra
- Using :remote => true with hover event
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
Many Rails helpers take multiple hash arguments. The first is usually the options to control the helper itself, and the second is the html_options where you specifiy custom ids, classes etc.
The method definition looks like this:
You'll notice the multiple '= {}' in the params list. To use this, the first set of options that you would specify must actually be enclosed in braces:
If you don't have any options to specify besides the html class, then just put an empty hash placeholder:
Additional API documentation is available at: http://apidock.com/rails/ActionView/Helpers/FormOptionsHelper/collection_select