Rails has_many through without join tables - Proposal


/ Published in: Rails
Save to your folder(s)



Copy this code and paste it in your HTML
  1. # acts_as_roleable
  2. create_table :users, :force => true do |t|
  3. t.string :name
  4. # ...
  5. end
  6.  
  7. # acts_as_roleable
  8. create_table :groups, :force => true do |t|
  9. t.string :name
  10. # ...
  11. end
  12.  
  13. create_table :memberships, :force => true do |t|
  14. t.integer :group_id
  15. t.integer :user_id
  16. end
  17.  
  18. create_table :roles, :force => true do |t|
  19. t.string :name
  20. t.column :roleable_id, :integer
  21. t.column :roleable_type, :string
  22. end
  23.  
  24. create_table :permissions, :force => true do |t|
  25. t.string :role_id
  26. t.string :name
  27. # ...
  28. end

URL: removing-the-join-table-in-rails

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.