Class: Storytime::ApplicationController

Inherits:
Object
  • Object
show all
Includes:
Pundit::Authorization, Concerns::ControllerContentFor, Concerns::CurrentSite
Defined in:
app/controllers/storytime/application_controller.rb

Instance Method Summary collapse

Methods included from Concerns::CurrentSite

#current_storytime_site

Methods included from Concerns::ControllerContentFor

#content_for, #content_for?, #view_context

Instance Method Details

#authenticate_user!Object



23
24
25
# File 'app/controllers/storytime/application_controller.rb', line 23

def authenticate_user!
  send("authenticate_#{Storytime.user_class_underscore_all}!".to_sym)
end

#current_userObject



27
28
29
# File 'app/controllers/storytime/application_controller.rb', line 27

def current_user
  send("current_#{Storytime.user_class_underscore_all}".to_sym)
end

#setupObject



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/storytime/application_controller.rb', line 36

def setup
  url = if Storytime.user_class.count == 0
    Storytime.registration_path
  elsif current_user.nil?
    Storytime.
  elsif Storytime::Site.count == 0
    new_dashboard_site_url
  else
    url_for([:dashboard, Storytime::Page])
  end

  redirect_to url
end

#user_signed_in?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'app/controllers/storytime/application_controller.rb', line 31

def user_signed_in?
  send("#{Storytime.user_class_underscore_all}_signed_in?".to_sym)
end