seanski / nashville-developers

This is the app that we will be building in the Ruby on Rails Beginner's Meetup
7 stars 9 forks source link

added instructions for facebook oauth #10

Closed mattSpell closed 9 years ago

mattSpell commented 9 years ago

Let me know if anything else should be added.

seanski commented 9 years ago

Also, please merge back into your fork. I just closed out a pull request that conflicts with this.

mattSpell commented 9 years ago

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.

seanski commented 9 years ago

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
mattSpell commented 9 years ago

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.

seanski commented 9 years ago

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. :-)

mattSpell commented 9 years ago

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.