Module: Socialite::Controllers::Helpers

Extended by:
ActiveSupport::Concern
Defined in:
lib/socialite/controllers/helpers.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) after_failure_path



49
50
51
# File 'lib/socialite/controllers/helpers.rb', line 49

def after_failure_path
  main_app.root_path
end


41
42
43
# File 'lib/socialite/controllers/helpers.rb', line 41

def after_link_path
  main_app.root_path
end

- (Object) after_login_path



53
54
55
# File 'lib/socialite/controllers/helpers.rb', line 53

def 
  main_app.root_path
end

- (Object) after_logout_path



57
58
59
# File 'lib/socialite/controllers/helpers.rb', line 57

def after_logout_path
  main_app.root_path
end

- (Object) after_signup_path



45
46
47
# File 'lib/socialite/controllers/helpers.rb', line 45

def 
  main_app.root_path
end

- (Object) current_user



10
11
12
13
14
15
16
# File 'lib/socialite/controllers/helpers.rb', line 10

def current_user
  @current_user ||= if session.has_key?(:user_id)
                      Socialite.user_class.find(session[:user_id])
                    end
rescue ActiveRecord::RecordNotFound
  session[:user_id] = nil
end

- (Object) current_user=(user)



36
37
38
39
# File 'lib/socialite/controllers/helpers.rb', line 36

def current_user=(user)
  @current_user = user
  session[:user_id] = user.nil? ? user : user.id
end

- (Object) ensure_user



18
19
20
21
22
23
24
25
26
# File 'lib/socialite/controllers/helpers.rb', line 18

def ensure_user
  if defined?(super)
    super
  else
    unless user_signed_in?
      redirect_to , :alert => I18n.t('socialite.login_required')
    end
  end
end

- (Object) logout!



28
29
30
# File 'lib/socialite/controllers/helpers.rb', line 28

def logout!
  self.current_user = nil and session.destroy
end

- (Boolean) user_signed_in?

Returns:

  • (Boolean)


32
33
34
# File 'lib/socialite/controllers/helpers.rb', line 32

def user_signed_in?
  !!current_user
end