class Membership < ActiveRecord::Base
belongs_to :role
belongs_to :user
end
class User < ActiveRecord::Base
has_many :roles, :through => :memberships
end
class Role < ActiveRecord::Base
has_many :users, :through => :memberships
end
और मेरे देखेंसंघ नहीं मिल सका, रेल 3
<% for role in Role.find(:all) %>
<div>
<%=check_box_tag "user[role_ids][]", role.id, @user.roles.include?(role) %>
<%=role.name%>
</div>
<% end %>
मैं अपने दृश्य पर अगले त्रुटि मिल गया है - संघ नहीं मिल सका: मॉडल उपयोगकर्ता में सदस्यता और मैं नहीं कर सकता समझ में ऐसा क्यों होता है ..
धन्यवाद, आप आदमी हैं! – paxer