Skip to content

Instantly share code, notes, and snippets.

@juanm55
Created November 30, 2011 01:17
Show Gist options
  • Save juanm55/1407508 to your computer and use it in GitHub Desktop.
Save juanm55/1407508 to your computer and use it in GitHub Desktop.
a question regarding select tag in rails form helper...
<td>Project<br/ >
<%= f.select :project_id, Project.all.collect{|a| [a.name, a.id]}%></td>
# the idea would be to do something similar to what one can do with text_tag
<%= text_tag :comment, :size => 10 %> # which renders a text_input element,,, with 10 spaces for character input...
#I came to this problem because Project's names are quite long for what the default size of the select tag is... or do you know any other clever way of making the select tag be at least as long as the longest of the projects' name???
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment