Last active
August 16, 2019 08:15
-
-
Save hoblin/9e1fbb7219819fdc3d9b89d6c2e26bf5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Permission < ApplicationRecord | |
has_many :roles through: :roles_permissions | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Role < ApplicationRecord | |
has_many :users through: :users_roles | |
has_many :permissions through: :roles_permissions | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RolesPermission < ApplicationRecord | |
belongs_to :role | |
belongs_to :permission | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ApplicationRecord | |
has_many :roles through: :users_roles | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UsersRole < ApplicationRecord | |
belongs_to :user | |
belongs_to :role | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment