Last active
August 29, 2015 14:00
-
-
Save igaiga/11360639 to your computer and use it in GitHub Desktop.
factory.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Account | |
def self.create(params, provider) | |
case provider | |
when "facebook" | |
Facebook.new(params) | |
when "google_oauth2" | |
Google.new(params) | |
end | |
end | |
end | |
# facebookのとき | |
account = Account.create(param,"facebook") | |
account.find_by_email_and_provider(email, provider) #この行がgoogleと同じになる | |
# googleのとき | |
account = Account.create(param,"google_oauth2") | |
account.find_by_email_and_provider(email, provider) #この行がfbと同じになる | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment