Skip to content

Instantly share code, notes, and snippets.

@paradigm314
Created July 12, 2017 18:40
Show Gist options
  • Save paradigm314/d6277b288de1f24a635ef51c3be9b952 to your computer and use it in GitHub Desktop.
Save paradigm314/d6277b288de1f24a635ef51c3be9b952 to your computer and use it in GitHub Desktop.
Rails Relationship Methods
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