Guest User

Untitled

a guest
Jul 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. class Account < ActiveRecord::Base
  2. has_many :manages
  3. has_many :users, :through => :manages
  4. end
  5.  
  6. class User < ActiveRecord::Base
  7. has_many :manages
  8. has_many :accounts, :through => :manages
  9. end
  10.  
  11. acc = usr.accounts.build
  12. acc.save
  13.  
  14. usr.accounts
  15.  
  16. acc.users
  17.  
  18. class Manage < ActiveRecord::Base
  19. belongs_to :user
  20. belongs_to :account
  21. end
Add Comment
Please, Sign In to add comment