Module: Garage::RestfulActions
- Extended by:
- ActiveSupport::Concern
- Included in:
- Meta::DocsController, Meta::ServicesController
- Defined in:
- lib/garage/restful_actions.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#create ⇒ Object
Public: Create a new resource Calls ‘create_resource` in your controller to create a new resource Requires `:write` permission on `resource_class` specified for `@resources`.
-
#destroy ⇒ Object
Public: Delete the resource Calls ‘destroy_resource` in your controller to destroy `@resource` Requires `:write` permission on `@resource`.
-
#index ⇒ Object
Public: List resources Renders ‘@resources` with options specified with `respond_with_resources_options` Requires `:read` permission on `resource_class` specified for `@resources`.
-
#show ⇒ Object
Public: Get the resource Renders ‘@resource` with options specified with `respond_with_resource_options` Requires `:read` permission on `@resource`.
-
#update ⇒ Object
Public: Update the resource Calls ‘update_resource` in your controller to update `@resource` Requires `:write` permission on `@resource`.
Instance Method Details
#create ⇒ Object
Public: Create a new resource Calls ‘create_resource` in your controller to create a new resource Requires `:write` permission on `resource_class` specified for `@resources`
71 72 73 74 |
# File 'lib/garage/restful_actions.rb', line 71 def create @resource = create_resource respond_with @resource, :location => location end |
#destroy ⇒ Object
Public: Delete the resource Calls ‘destroy_resource` in your controller to destroy `@resource` Requires `:write` permission on `@resource`
87 88 89 90 |
# File 'lib/garage/restful_actions.rb', line 87 def destroy @resource = destroy_resource respond_with @resource, end |
#index ⇒ Object
Public: List resources Renders ‘@resources` with options specified with `respond_with_resources_options` Requires `:read` permission on `resource_class` specified for `@resources`
57 58 59 |
# File 'lib/garage/restful_actions.rb', line 57 def index respond_with @resources, end |
#show ⇒ Object
Public: Get the resource Renders ‘@resource` with options specified with `respond_with_resource_options` Requires `:read` permission on `@resource`
64 65 66 |
# File 'lib/garage/restful_actions.rb', line 64 def show respond_with @resource, end |
#update ⇒ Object
Public: Update the resource Calls ‘update_resource` in your controller to update `@resource` Requires `:write` permission on `@resource`
79 80 81 82 |
# File 'lib/garage/restful_actions.rb', line 79 def update @resource = update_resource respond_with @resource, end |