Class: Tramway::Core::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/tramway/core/application_controller.rb

Instance Method Summary collapse

Instance Method Details

#applicationObject



7
8
9
10
11
# File 'app/controllers/tramway/core/application_controller.rb', line 7

def application
  return unless ::Tramway::Core.application

  @application ||= Tramway::Core.application&.model_class&.first || Tramway::Core.application
end

#authenticated_userObject



21
22
23
# File 'app/controllers/tramway/core/application_controller.rb', line 21

def authenticated_user
  (defined?(current_user) && current_user.try(:model)) || (defined?(current_admin) && current_admin.model)
end

#load_extensionsObject



13
14
15
# File 'app/controllers/tramway/core/application_controller.rb', line 13

def load_extensions
  ::Tramway::Extensions.load if defined? ::Tramway::Extensions
end

#model_classObject



17
18
19
# File 'app/controllers/tramway/core/application_controller.rb', line 17

def model_class
  params[:model].constantize
end