Any ideas on how the best way to handle this? If you have a select() form helper, and you use the :variable, and :attribute parameters. the resulting <select> tag combines them in the id attribute: E.g. <%= select(:user, :name, %w{some tag values} %> turns into: <select id="user_name" name="user[name]"> .... This is Ok and it works so the model can extract the information from the @params array. But it screws up my CSS. (legacy CSS) Since there is no selector called #user_name to match the id attribute, it reverts to the enclosing style Is this just a neccessary evil? Or am I missing something obvious here? Such as :class => "myOptionsStyle" in the html_options hash? Thanks for your input. BTW, I solved it short term by adding the #user_name seletor to the style sheet. Ed
Ed Howland wrote:> <select id="user_name" name="user[name]"> > .... > This is Ok and it works so the model can extract the information from > the @params array. But it screws up my CSS. (legacy CSS) Since there > is no selector called #user_name to match the id attribute, it reverts > to the enclosing style > > Is this just a neccessary evil? Or am I missing something obvious > here? Such as :class => "myOptionsStyle" in the html_options hash?Yes, you can set the class HTML atrribute and/or override the id attribute through the helper''s html_options hash. It''s the name attribute that can''t be changed if you want Rails to create a structured params hash. -- We develop, watch us RoR, in numbers too big to ignore.
On 10/27/05, Mark Reginald James <mrj-bzGI/hKkdgQnC9Muvcwxkw@public.gmane.org> wrote:> > Yes, you can set the class HTML atrribute and/or override the id > attribute through the helper''s html_options hash. It''s the name > attribute that can''t be changed if you want Rails to create > a structured params hash. >Thanks, that is the info I was looking for. So the model won''t be affected by changing the id. Ed
Ed Howland wrote:> On 10/27/05, Mark Reginald James <mrj-bzGI/hKkdgQnC9Muvcwxkw@public.gmane.org> wrote: > >>Yes, you can set the class HTML atrribute and/or override the id >>attribute through the helper''s html_options hash. It''s the name >>attribute that can''t be changed if you want Rails to create >>a structured params hash. > > Thanks, that is the info I was looking for. So the model won''t be > affected by changing the id.No, DB/Active Record ids have no relation to HTML element ids. -- We develop, watch us RoR, in numbers too big to ignore.