Class: ActionController::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/hobo_devise.rb

Class Method Summary collapse

Class Method Details

.hobo_devise_oauth2_facebook_controller(model) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/hobo_devise.rb', line 32

def self.hobo_devise_oauth2_facebook_controller(model)
  @@model = model
  self.class_eval do
    hobo_user_controller
    include DeviseOauth2Facebook::FacebookConsumerHelper
    include DeviseOauth2Facebook::ControllerMethods

    def resource_name; @@model.to_s.downcase; end
    def resource_class; @@model; end
    def initialize; action_methods.add "callback"; end

    def set_flash_message(type, message)
      flash[type] = message
    end

    def (resource_name, user)
      redirect_to "/"
      options = {:notice => ht(:"#{model.to_s.underscore}.messages.logout", :default=>["You have logged out."]),
                                    :redirect_to => base_url}
      sign_user_in(user, options)
    end
  end
end