Class: ResourcesController::SingletonResourceService
- Inherits:
-
ResourceService
- Object
- ActiveSupport::ProxyObject
- ResourceService
- ResourcesController::SingletonResourceService
- Defined in:
- lib/resources_controller.rb
Instance Attribute Summary
Attributes inherited from ResourceService
Instance Method Summary collapse
- #destroy(*args) ⇒ Object
- #find(*args) ⇒ Object
-
#new(*args, &block) ⇒ Object
build association on the enclosing resource if there is one, otherwise call new.
- #service ⇒ Object
Methods inherited from ResourceService
#initialize, #method_missing, #respond_to?
Constructor Details
This class inherits a constructor from ResourcesController::ResourceService
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ResourcesController::ResourceService
Instance Method Details
permalink #destroy(*args) ⇒ Object
[View source] [View on GitHub]
797 798 799 |
# File 'lib/resources_controller.rb', line 797 def destroy(*args) find.destroy end |
permalink #find(*args) ⇒ Object
[View source] [View on GitHub]
782 783 784 785 786 787 788 789 790 |
# File 'lib/resources_controller.rb', line 782 def find(*args) if resource_specification.find resource_specification.find_custom(controller) elsif controller.enclosing_resources.size > 0 enclosing_resource.send(resource_specification.source) else ::ResourcesController.raise_cant_find_singleton(controller.resource_name, controller.resource_class) end end |
permalink #new(*args, &block) ⇒ Object
build association on the enclosing resource if there is one, otherwise call new
793 794 795 |
# File 'lib/resources_controller.rb', line 793 def new(*args, &block) enclosing_resource ? enclosing_resource.send("build_#{resource_specification.source}", *args, &block) : service.new(*args, &block) end |
permalink #service ⇒ Object
[View source] [View on GitHub]
801 802 803 |
# File 'lib/resources_controller.rb', line 801 def service resource_class end |