John-Mason P. Shackelford
2005-May-24 19:56 UTC
collection select form helpers in a partial?
I am having a hard time understanding how I would use the select form helper in a situation where I have a collection of select boxes which are being rendered by partials. Problem #1 is that select uses instance variables whereas partials use local variables so I think I''d need to convert local variables to instance variables from in the partial itself, which seems wierd. Problem #2 It isn''t very clear from the docs how collections of form elements should be named in the html. If try to use the notation model[id], the select tag freaks out: `@grant[8]'' is not allowed as an instance variable name If I try to use the notation model_id than @params[:model] doesn''t return the list of records for the model. I can reinvent the wheel by manually creating the select tag with content_tag and options_for_select, but this is counter intuitive given the existence of the select helper. I suggest that it should either be more flexible or should cease to exist since as it stands it is only a source of confusion. Unless I am missing something obvious (it has happened before :s ) it seems that the select form helper needs a hard look before 1.0. -- John-Mason Shackelford Software Developer Pearson Educational Measurement 2510 North Dodge St. Iowa City, IA 52245 ph. 319-354-9200x6214 john-mason.shackelford-uJfvbxoDSvxBDgjK7y7TUQ@public.gmane.org http://pearsonedmeasurement.com