2

I've been reading through the SpreeSocial documentation here. I can't figure out how to remove providers through the config. I've tried to just pop the most recent provider off off of the list but that's not working.

  SpreeSocial::OAUTH_PROVIDERS.pop

I managed to make the 'Sign in with LinkedIn' appear in the views, but I'd like to remove the 'Sign in with Google+' link.

SpreeSocial::OAUTH_PROVIDERS << ['LinkedIn', 'linkedin', 'true']
SpreeSocial.init_provider('linkedin')

If I want to open up the classes in SpreeSocial with .class_eval (I assume that this may help me edit which providers are available), where would I place those files so that they would autoload, or where would I need to configure them? Pretty new to Spree/Rails so not too familiar with configurations and initializers. Thanks for the help!

I'd like to be able to call .class_eval on the SpreeSocial Module here

Mary
  • 109
  • 10
  • Why don't you just clone the gem and point Gemfile to the local version of the gem? That way you can override whatever you need without having to do class_eval. – NM Pennypacker May 15 '15 at 20:45
  • Is that good practice? I suppose I could. Would like to know how to do it though. I'll do that if I can't figure it out the other way! Thanks for the tip! :) – Mary May 15 '15 at 22:31

1 Answers1

0

SpreeSocial::OAUTH_PROVIDERS is going to be redefined when the code initializes the application so just using pop won't be sufficient. Since SpreeSocial is a module not a class you'll need to either:

1) Use a module_eval not a class_eval to redefine the SpreeSocial::OAUTH_PROVIDERS

SpreeSocial.module_eval do OAUTH_PROVIDERS = [ %w(Facebook facebook true), %w(Twitter twitter false), %w(Github github false), %w(Amazon amazon false) ] end

or

2) You could override the methods that determine active authentication methods to not return google: https://github.com/spree-contrib/spree_social/blob/master/app/models/spree/authentication_method.rb#L4-L12

JDutil
  • 3,622
  • 25
  • 32