Module: TypicalSituation

Includes:
FlashMessages, Identity, Operations, Permissions, Responses
Defined in:
lib/typical_situation.rb,
lib/typical_situation/engine.rb,
lib/typical_situation/actions.rb,
lib/typical_situation/version.rb,
lib/typical_situation/identity.rb,
lib/typical_situation/responses.rb,
lib/typical_situation/operations.rb,
lib/typical_situation/permissions.rb,
lib/typical_situation/flash_messages.rb

Defined Under Namespace

Modules: Actions, ClassMethods, FlashMessages, Identity, Operations, Permissions, Responses Classes: ActionForbidden, Engine, Error

Constant Summary collapse

VERSION =
"1.0.2"

Class Method Summary collapse

Methods included from Responses

#after_resource_created_path, #after_resource_destroyed_path, #after_resource_updated_path, #changed_so_redirect, #gone_so_redirect, #respond_as_changed, #respond_as_created, #respond_as_error, #respond_as_forbidden, #respond_as_gone, #respond_as_not_found, #respond_with_resource, #respond_with_resources

Methods included from Operations

#assign_resource, #build_resource, #create_resource, #default_sorting_attribute, #default_sorting_direction, #destroy_resource, #find_resource, #get_resource, #get_resources, #has_errors?, #model_class, #new_resource, #paginate_resources, #pagination_params, #scoped_resource, #serializable_resource, #serialize_resource, #serialize_resources, #set_collection_instance, #set_single_instance, #update_resource

Methods included from Permissions

#authorized?

Methods included from Identity

#collection, #create_params, #find_in_collection, #include_root?, #location_url, #model_params, #model_type, #permitted_create_params, #permitted_update_params, #plural_model_type, #update_params

Class Method Details

.add_rescues(action_controller) ⇒ Object



64
65
66
67
68
69
# File 'lib/typical_situation.rb', line 64

def self.add_rescues(action_controller)
  action_controller.class_eval do
    rescue_from ActiveRecord::RecordNotFound, with: :respond_as_not_found
    rescue_from TypicalSituation::ActionForbidden, with: :respond_as_forbidden
  end
end

.included(base) ⇒ Object



21
22
23
24
# File 'lib/typical_situation.rb', line 21

def self.included(base)
  add_rescues(base)
  base.extend(ClassMethods)
end