My model association looks like this
class User < ActiveRecord::Base
has_many :correlations
has_many :roles, :through => :correlations
has_many :skills, :through => :correlations
end
class Skill < ActiveRecord::Base
has_many :correlations
has_many :roles, :through => :correlations
has_many :users, :through => :correlations
end
class Role < ActiveRecord::Base
has_many :correlations
has_many :users, :through => :correlations
has_many :skills, :through => :correlations
end
class Correlation < ActiveRecord::Base
belongs_to :role
belongs_to :skill
belongs_to :user
end
ON update user each time i have two tpuples in db
for e.g
role_id user_id skill_id
admin_id u_id Null
Null u_id
skill_id
instead of
role_id user_id skill_id
admin_id u_id skill_id
#users/controller
def update
@user = User.find(params[:id])
respond_to do |format|
if @user.update_attributes(params[:user])
format.html { redirect_to(@user, :notice => ''User was
successfully
updated.'') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @user.errors, :status =>
:unprocessable_entity }
end
end
end
Please suggest
Thanks in advance
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/eHN4b2s3YWQ0MTRK.
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.