Sha256: 19af06e8defe1d424d598773fdd156e780b338bc669519f21ab6a4b2f4e8d5a9
Contents?: true
Size: 528 Bytes
Versions: 11
Compression:
Stored size: 528 Bytes
Contents
h1. Alternative Multi Roles setup <pre> class UsersHaveAndBelongToManyRoles < ActiveRecord::Migration def self.up create_table :roles_users, :id => false do |t| t.references :role, :user end end def self.down drop_table :roles_users end end </pre> And your models look like this: <pre> # User Model class User < ActiveRecord::Base has_and_belongs_to_many :roles .... # Role model class Role < ActiveRecord::Base has_and_belongs_to_many :users end </pre>
Version data entries
11 entries across 11 versions & 1 rubygems