I have the following form:
<%=form_for [:project, @permission], :url => { :action => "update" } do |f| %>
<% roles = Role.all %>
Role: <%= f.collection_select :role_id, roles, :id, :name, :prompt => true %>
<%=f.submit "Send Request" %>
<%=f.hidden_field :user_id %>
<% end %>
In my controller I have:
def update
@permission = Permission.find_by_user_id(params[:user_id])
.
.
.
end
** What I want to do is update the role_id,,,, so I need the above to find the permission record... Problem is,,, params[:user_id] is coming back null?
Am I missing something? thanks
Update
Here is the error and request params, which show the vars are there?
Started POST "/projects/3/permissions/useronproject" for 127.0.0.1 at Thu Oct 14 12:17:12 -0700 2010 Processing by PermissionsController#update as HTML Parameters: {"commit"=>"Send Request", "authenticity_token"=>"KJ2C20MzTJ8VQV0NiNzOr357QKV5hWjeuazOBcS5iPU=", "utf8"=>"✓", "id"=>"useronproject", "permission"=>{"role_id"=>"1", "user_id"=>"11"}, "project_id"=>"3"}
User Load (0.3ms) SELECT "users".* FROM "users" WHERE ("users"."id" = 1) LIMIT 1
Permission Load (0.1ms) SELECT "permissions".* FROM "permissions" WHERE ("permissions"."user_id" IS NULL) LIMIT 1
see - user_id is NULL?