I had a select tag that I wanted to mess with a little to apply some styles etc. to. The select tag has an html_options hash and I was trying to use that. My initial attempt was
This is not python, and even though the rails docs setout the syntax as:
ruby can not accept keyword arguments. Only positional, so you have to do:
The empty braces signify the empty 'options' argument, and the next set of braces signify the html_options hash
select('history', 'sel', history_list, html_options => {:class => 'historyselect'})
WRONGThis is not python, and even though the rails docs setout the syntax as:
select(object, method, choices, options = {}, html_options = {})
ruby can not accept keyword arguments. Only positional, so you have to do:
select('history', 'sel', history_list, {}, {:class => 'historyselect'})
The empty braces signify the empty 'options' argument, and the next set of braces signify the html_options hash
Thanks very helpful , was having the exact same problem.
ReplyDeleteHow would I use link_to html_options to use the strong html attribute??
ReplyDeleteThanks a lot! This helped very much. :)
ReplyDeleteRails is beginning to irritate me.
ReplyDeleteirritating ... yes.
ReplyDeleteThanks KG for posting. Very helpful.