Skip to content

Instantly share code, notes, and snippets.

@kwstannard
Last active August 29, 2015 14:07
Show Gist options
  • Save kwstannard/7b8e78e370f3f72275d5 to your computer and use it in GitHub Desktop.
Save kwstannard/7b8e78e370f3f72275d5 to your computer and use it in GitHub Desktop.
class UserFinder
def self.find(id)
record = User.find(id)
"#{record.user_type}User".constantize.new(record)
end
end
class User < ActiveRecord::Base
end
class LDAPUser < SimpleDelegator
def foo
common_data + ldap_specific_data
end
end
class LocalUser < SimpleDelegator
def foo
common_data + local_specific_data
end
end
UserFinder.find(23)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment