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 sign_in_and_redirect(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
|