Class: Wallaby::BaseController

Inherits:
SecureController show all
Defined in:
app/controllers/wallaby/base_controller.rb

Overview

Base controller to provide basic helper methods for sub classes

Direct Known Subclasses

AbstractResourcesController

Constant Summary

Constants inherited from ApplicationController

ApplicationController::ERROR_PATH

Instance Method Summary collapse

Methods inherited from SecureController

#current_user, #forbidden, #security_config, #unauthorized

Methods inherited from ApplicationController

#bad_request, #configuration, configuration, #healthy, #not_found, #unprocessable_entity

Instance Method Details

#current_model_classClass

Returns the model class that links to the resources name.

Returns:

  • (Class)

    the model class that links to the resources name



17
18
19
20
21
# File 'app/controllers/wallaby/base_controller.rb', line 17

def current_model_class
  @current_model_class ||=
    self.class.respond_to?(:model_class) && self.class.model_class \
    || Map.model_class_map(current_resources_name)
end

#current_resources_nameString

Returns the resources name coming from params.

Returns:

  • (String)

    the resources name coming from params



12
13
14
# File 'app/controllers/wallaby/base_controller.rb', line 12

def current_resources_name
  @current_resources_name ||= params[:resources]
end