Skip to content

Instantly share code, notes, and snippets.

@azuby
Forked from radar/gist:1441191
Created December 7, 2011 02:49
Show Gist options
  • Save azuby/1441213 to your computer and use it in GitHub Desktop.
Save azuby/1441213 to your computer and use it in GitHub Desktop.
validates :superiority
def superiority
User.find(superior_id).company_id == User.find(inferior_id).company_id
end
# Karpah's method
validates :superior_id, :if => "User.find(superior_id).company_id == User.find(inferior_id).company_id"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment