-
-
Save slashmili/87abbf74e8020ca7e95c to your computer and use it in GitHub Desktop.
This file contains hidden or 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 < ActiveRecord::Base | |
| has_many :memberships | |
| has_many :boards, through: :memberships | |
| end | |
| class Board < ActiveRecord::Base | |
| has_many :memberships | |
| end | |
| class Membership < ActiveRecord::Base | |
| belongs_to :user | |
| belongs_to :board | |
| def role | |
| return :admin if role_mask == 1 | |
| return :member if role_mask == 4 | |
| end | |
| end | |
| #how can I get here ? | |
| current_user.boards[0].role |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment