Skip to content
This repository has been archived by the owner on Jun 16, 2020. It is now read-only.

Improvements for form helpers #69

Open
ak-unitb opened this issue May 28, 2015 · 0 comments
Open

Improvements for form helpers #69

ak-unitb opened this issue May 28, 2015 · 0 comments

Comments

@ak-unitb
Copy link

Hi there,

i wasn't really satisfied with the given example about the view ... (typing plain HTMl isn't really the rails way ;) )

i found this - well also not really satisfying - solution:
{code}
<% i = 0 %>
<% for role in Person.values_for_roles do %>
<%= check_box_tag "person[roles][]", role, @person.roles.include?(role), {:id => "person_roles_" + (i+=1).to_s } %>
<%= f.label "roles_" + i.to_s, role.to_s.titleize %>
<% end %>
{code}

As far as i see, collection_check_boxes can't be used, too (expects a collection of objects)

Are there any better solutions out there?
Or is there for the default form helpers anything missing?
Or had i just been blind and missed something`?

Could you please provide an example in the DOC?

(PS.: i'm at the start of creating an application, and still not sure, which bitmask booleans in the end will be needed ... so, i'm really interested in just editing the model and not the views, too - in case of ;) )

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant