I have a two models Projects and users. I have a many to many
relation. Means that all users can be in a project and a user van be
in many porjects. A user can be a Member, Admin. i created the
relation table as projects_users and added a role_id. For this i
created a view that list the users in the project in check boxes, so
if you check the box it became an admin, so i pass an array, but when
i save i sends an ActiveRecord::ReadOnlyRecord error.
def updaterole
@project = Project.find(params[:id])
if 1 == 1
@test = @project.users.find(params[:user_ids])
for resource in @test
resource.role_id = 2
resource.save # here is the error
end
flash[:notice] = ''Succeed.''
redirect_to :action => ''resources'', :id =>
@project
else
render :action => ''add''
end
end
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---