Created
July 12, 2017 18:40
-
-
Save paradigm314/d6277b288de1f24a635ef51c3be9b952 to your computer and use it in GitHub Desktop.
Rails Relationship Methods
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
has_many :organizations, through: :user_roles do | |
def default | |
where(:default_organization_id => self.id).first | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment