Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve possible logic in views #9

Closed
ak-unitb opened this issue May 27, 2015 · 1 comment
Closed

improve possible logic in views #9

ak-unitb opened this issue May 27, 2015 · 1 comment

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 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 %>
<input type="hidden" name="person[roles][]" value="none">
{code}

Are there any better solutions out there?
Or are there for the default form helpers anything missing?

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 ;) )

@ak-unitb
Copy link
Author

I recognized i put this in the former master ... Sry ... i copied it to the new master branch joelmoss#69

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

No branches or pull requests

1 participant