Class: CullenderController
- Inherits:
-
Object
- Object
- CullenderController
- Includes:
- Cullender::Controllers::ScopedViews
- Defined in:
- app/controllers/cullender_controller.rb
Overview
All Cullender controllers are inherited from here.
Direct Known Subclasses
Instance Method Summary collapse
-
#_prefixes ⇒ Object
Override prefixes to consider the scoped view.
-
#cullender_mapping ⇒ Object
Attempt to find the mapped route for cullender based on request path.
-
#resource ⇒ Object
Gets the actual resource stored in the instance variable.
-
#resource_class ⇒ Object
Proxy to cullender map class.
-
#resource_name ⇒ Object
(also: #scope_name)
Proxy to cullender map name.
- #resource_params ⇒ Object
Instance Method Details
#_prefixes ⇒ Object
Override prefixes to consider the scoped view. Notice we need to check for the request due to a bug in Action Controller tests that forces _prefixes to be loaded before even having a request object.
42 43 44 45 46 47 48 |
# File 'app/controllers/cullender_controller.rb', line 42 def _prefixes #:nodoc: @_prefixes ||= if self.class.scoped_views? && request && cullender_mapping super.unshift("#{cullender_mapping.scoped_path}/#{controller_name}") else super end end |
#cullender_mapping ⇒ Object
Attempt to find the mapped route for cullender based on request path
34 35 36 |
# File 'app/controllers/cullender_controller.rb', line 34 def cullender_mapping @cullender_mapping ||= request.env["cullender.mapping"] end |
#resource ⇒ Object
Gets the actual resource stored in the instance variable
14 15 16 |
# File 'app/controllers/cullender_controller.rb', line 14 def resource instance_variable_get(:"@#{resource_name}") end |
#resource_class ⇒ Object
Proxy to cullender map class
25 26 27 |
# File 'app/controllers/cullender_controller.rb', line 25 def resource_class cullender_mapping.to end |
#resource_name ⇒ Object Also known as: scope_name
Proxy to cullender map name
19 20 21 |
# File 'app/controllers/cullender_controller.rb', line 19 def resource_name cullender_mapping.name end |
#resource_params ⇒ Object
29 30 31 |
# File 'app/controllers/cullender_controller.rb', line 29 def resource_params params[resource_name] end |