Module: UtopiaData::Resource::Controllers
- Included in:
- UtopiaData::Resource
- Defined in:
- lib/utopia_data/resource/controllers.rb
Instance Method Summary collapse
-
#controller ⇒ Object
Returns the controller for this config.
-
#controller_name ⇒ Object
Returns a properly formatted controller name for this config within its namespace.
-
#create_resource_controller ⇒ Object
Create the resource controller.
Instance Method Details
#controller ⇒ Object
Returns the controller for this config
33 34 35 |
# File 'lib/utopia_data/resource/controllers.rb', line 33 def controller @controller ||= controller_name.constantize end |
#controller_name ⇒ Object
Returns a properly formatted controller name for this config within its namespace
28 29 30 |
# File 'lib/utopia_data/resource/controllers.rb', line 28 def controller_name [resource_name.plural.camelize + "Controller"].compact.join('::') end |
#create_resource_controller ⇒ Object
Create the resource controller
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/utopia_data/resource/controllers.rb', line 38 def create_resource_controller controller_class = <<-CONTROLLER class ::#{controller_name} < UtopiaData::ResourceController responders Roar::Rails::Responder end CONTROLLER eval controller_class controller.utopia_config = self end |