Skip to content

Instantly share code, notes, and snippets.

@eriknomitch
Last active August 29, 2015 14:03
Show Gist options
  • Save eriknomitch/f8b80f861f4c93eded93 to your computer and use it in GitHub Desktop.
Save eriknomitch/f8b80f861f4c93eded93 to your computer and use it in GitHub Desktop.
def self.user_types
[:candidate, :influencer, :employee]
end
User.user_types.each do |user_type|
define_method "#{user_type}?" do
!!send(user_type)
end
end
def is_type?(user_type)
user_type = user_type.to_sym
raise "Not a valid User type." unless User.user_types.member? user_type
send("#{user_type}?")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment