Module: SkinnyControllers::Lookup::Controller
- Defined in:
- lib/skinny_controllers/lookup/controller.rb
Class Method Summary collapse
-
.model_name(controller) ⇒ String
Name of the class of the model.
-
.namespace ⇒ String
TODO: add option to configure this per controller.
-
.resource_name(controller_name) ⇒ String
The resource name.
Class Method Details
.model_name(controller) ⇒ String
Returns name of the class of the model.
17 18 19 20 21 |
# File 'lib/skinny_controllers/lookup/controller.rb', line 17 def model_name(controller) resource_name = Controller.resource_name(controller) # Convert Resources to Resource resource_name.singularize end |
.namespace ⇒ String
TODO: add option to configure this per controller
32 33 34 35 |
# File 'lib/skinny_controllers/lookup/controller.rb', line 32 def namespace namespace = SkinnyControllers.controller_namespace || '' "#{namespace}::" if namespace end |
.resource_name(controller_name) ⇒ String
Returns the resource name.
8 9 10 11 12 13 |
# File 'lib/skinny_controllers/lookup/controller.rb', line 8 def resource_name(controller_name) name = controller_name.gsub('Controller', '') # remove the namespace if one exists name.slice! namespace name end |