Hello, I have the following Models:
Permissions (user_id, role_id, project_id)
Roles (id, name)
Projects (id, name)
I''m struggling to make a form to allow a user to either Add or Update
a User''s Project permission
Here''s what I have so far:
<%=form_for [@project,Permission.new], :remote => true do |f|%>
<%= f.collection_select("permission", "role_id",
@roles, "id") %>
<% end %>
What I want to happen on this form, is for it to show a dropdown of
available roles, and if the user is currently assigned to a role to
have that as the selected setting. If not, for the select dropdown box
to be blank.
Then if the user changes the select drop down, for it to post the
update back to the server. Where the controller would either create or
update (depending on if the user had a previous permission for a
project).
Can you help walk me through the flow of setting this up? thank you!
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.