# app/policies/twitter_policy.rb class TwitterPolicy < Struct.new(:auth) def first_name auth['info']['name'].split(' ').first end def last_name ..... end .... end # app/policies/facebook_policy.rb class FacebookPolicy < Struct.new(:auth) def first_name auth['info']['name'].split(' ').first end def last_name ..... end .... end # app/models/user.rb def self.from_oauth(auth) policy = "#{auth['provider']}_policy".classify.constantize.new(auth) create_user_from_policy(policy) end # check https://github.com/elabs/pundit for maximum usage of policies