Closed mattSpell closed 9 years ago
Also, please merge back into your fork. I just closed out a pull request that conflicts with this.
Oh ok cool. I’ll have to take a look at the CanCan docs. I merged your recent changes and I’m noticing that we’re close to tripling up on the "class << self" method in: app/models/user.rb. Should I try to refactor to use that method for all 3 (fb, twitter, linked in) or just add a twitter one like I had it? Thanks for putting up with my ignorance!
On Aug 30, 2014, at 11:11 AM, Sean Hill notifications@github.com wrote:
Also, please merge back into your fork. I just closed out a pull request that conflicts with this.
— Reply to this email directly or view it on GitHub.
Yeah, there only needs to be one class << self
.
It would like something like:
class << self
def find_or_create_by_facebook_oauth(auth, signed_in_resource = nil)
#…
def find_or_create_by_linkedin_oauth(auth, signed_in_resource = nil)
#…
def find_or_create_by_twitter_oauth(auth, signed_in_resource = nil)
#…
end
Will do. Do you think it would be worth trying to reuse that “find_or_createby#{provider}_oauth" method? Like maybe a switch statement or something?
On Sep 1, 2014, at 1:27 PM, Sean Hill notifications@github.com wrote:
Yeah, there only needs to be one class << self.
It would like something like:
class << self def find_or_create_by_facebook_oauth(auth, signed_in_resource = nil)
…
def find_or_create_by_linkedin_oauth(auth, signed_in_resource = nil)
…
def find_or_create_by_twitter_oauth(auth, signed_in_resource = nil)
…
end — Reply to this email directly or view it on GitHub.
Your head is in the right place, but I think refactoring this is a great lesson for the meetup. Just keep it separate for now. :-)
Sounds great! Thx On Sep 1, 2014, at 1:27 PM, Sean Hill notifications@github.com wrote:
Yeah, there only needs to be one class << self.
It would like something like:
class << self def find_or_create_by_facebook_oauth(auth, signed_in_resource = nil)
…
def find_or_create_by_linkedin_oauth(auth, signed_in_resource = nil)
…
def find_or_create_by_twitter_oauth(auth, signed_in_resource = nil)
…
end — Reply to this email directly or view it on GitHub.
Let me know if anything else should be added.