Class: Rango::RESTController

Inherits:
Controller show all
Includes:
CRUDMixin, ConventionalRendering
Defined in:
lib/rango/rest_controller.rb

Constant Summary

Constants included from Exceptions

Exceptions::ActionNotFound, Exceptions::ClientError, Exceptions::Error100, Exceptions::Error101, Exceptions::Error200, Exceptions::Error201, Exceptions::Error202, Exceptions::Error203, Exceptions::Error204, Exceptions::Error205, Exceptions::Error206, Exceptions::Error300, Exceptions::Error301, Exceptions::Error302, Exceptions::Error303, Exceptions::Error304, Exceptions::Error305, Exceptions::Error307, Exceptions::Error400, Exceptions::Error401, Exceptions::Error402, Exceptions::Error403, Exceptions::Error404, Exceptions::Error405, Exceptions::Error406, Exceptions::Error407, Exceptions::Error408, Exceptions::Error409, Exceptions::Error410, Exceptions::Error411, Exceptions::Error412, Exceptions::Error413, Exceptions::Error414, Exceptions::Error415, Exceptions::Error416, Exceptions::Error417, Exceptions::Error500, Exceptions::Error501, Exceptions::Error502, Exceptions::Error503, Exceptions::Error504, Exceptions::Error505, Exceptions::Informational, Exceptions::MultiPartParseError, Exceptions::ServerError, Exceptions::Successful

Instance Attribute Summary

Attributes inherited from Controller

#env

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ConventionalRendering

#autorender, #display, #render_relative, #template_basename, template_dirname, #template_dirname, template_dirname=, #template_path

Methods included from CRUDMixin

#create, #edit, #index, #new, #show, #update

Methods inherited from Controller

#absolute_uri, #action, call, dispatcher, #initialize, #invoke_action, #logger, #params, #redirect, #render_http_error, #request, #rescue_http_error, #response, #router_params, #run_action, #to_response

Methods included from UrlHelper

#crudtree_generator, #resource, #url

Constructor Details

This class inherits a constructor from Rango::Controller

Class Method Details

.named_routeObject



37
38
39
40
41
42
43
44
# File 'lib/rango/rest_controller.rb', line 37

def self.named_route
  @@named_route
rescue NameError
  @@named_route = begin
    name = self.class.name
    name.split("::").last.snake_case
  end
end

.named_route=(named_route) ⇒ Object



33
34
35
# File 'lib/rango/rest_controller.rb', line 33

def self.named_route=(named_route)
  @@named_route = named_route
end

.object_nameObject



15
16
17
18
19
20
21
22
# File 'lib/rango/rest_controller.rb', line 15

def self.object_name
  @@object_name
rescue NameError
  @@object_name = begin
    name = self.class.name
    name.split("::").last.snake_case
  end
end

.object_name=(object_name) ⇒ Object



11
12
13
# File 'lib/rango/rest_controller.rb', line 11

def self.object_name=(object_name)
  @@object_name = object_name
end

Instance Method Details

#collection_nameObject



29
30
31
# File 'lib/rango/rest_controller.rb', line 29

def collection_name
  @@collection_name ||= @@object_name.to_s.pluralize
end

#named_routeObject



46
47
48
# File 'lib/rango/rest_controller.rb', line 46

def named_route
  self.class.named_route
end

#object_nameObject



25
26
27
# File 'lib/rango/rest_controller.rb', line 25

def object_name
  self.class.object_name
end