I have a Product related to sizes by way of has_and_belongs_to_many.
Currently in my product form partial, I have this really ugly (although
functional) code. Note the hanging ">" that closes the
"<input>".
<p><label for="sizes">Sizes</label><br/>
<% for size in @sizes %>
<input type="checkbox"
id="<%= size.id %>"
name="size_ids[]"
value="<%= size.id %>"
<%if @product.sizes.include? size %>checked<%end%>
> <%= size.name %>
<% end %>
Is there a method that will let me do this and have nicer looking code?
I''ve had a hard time finding it if there is.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---