ruby 代码
- #thingsuser.rb
- class Thingsuser < ActiveRecord::Base
- belongs_to :user
- belongs_to :thing, :counter_cache => true
- end
ruby 代码
- #user.rb
- has_many :thingsusers
- has_many :things,:through=>:thingsusers,:dependent =>:destroy
ruby 代码
- #thing.rb
- has_many :thingsusers
- has_many :users, :through => :thingsusers
table.column:thingsusers_count