Skip to content

Instantly share code, notes, and snippets.

@erichurst
Created May 1, 2010 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erichurst/386711 to your computer and use it in GitHub Desktop.
Save erichurst/386711 to your computer and use it in GitHub Desktop.
def self.find_valid_referral(username)
case
when username.blank? then EarlyAdopter.first(:group => "distribution_count ASC").user_id
when !username.blank? && self.exists?(:username => username) then User.find_by_username(username).id
else nil
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment