I have a legacy DB without access to change the user or group table
(must use StoredProcedures to edit those). But I do have access to the
usergroup join so I thought the joins would be pretty much like my other
rails apps where I do HABTM checkboxes. I’ve created a page that just
shows habtm checkboxes for the join and the updates are occuring for the
join but I’m getting Access errors on the user table (which I should) .
how do I limit what RAILS wants to update to just the join table. I
thought this (http://wiki.rubyonrails.org/rails/pages/CheckboxHABTM)
would do it based on the last comment.
here’s my relevant parts
def joinupdate
@user = user.find(params[:user][:CodeMgmtUserId])
if !params[:user]
@user.groups.clear
else
if
@user.update_attribute(:group_ids,@params[‘user’][‘CodeMgmtgroupId’])
flash[‘notice’] = “Update Successful”
else
render_action ‘edit’
end
end
end
joinupdate.rhtml
Editing User/Group association for <%= @user.Name %>
<% group.find(:all, :order => "name ASC").each do |mygroup| %><%= check_box_tag 'user[CodeMgmtGroupId][]', mygroup.id, @user.groups.include?(mygroup) %> <%= mygroup.Name %> <% end %>
thanks
-zaq