Module: HalApi::Controller::Actions
- Extended by:
- ActiveSupport::Concern
- Included in:
- HalApi::Controller
- Defined in:
- lib/hal_api/controller/actions.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/hal_api/controller/actions.rb', line 18 def create create_resource.tap do |res| consume! res, res res.save! respond_with root_resource(res), end end |
#destroy ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/hal_api/controller/actions.rb', line 36 def destroy destroy_resource.tap do |res| res res.destroy head :no_content end end |
#index ⇒ Object
10 11 12 |
# File 'lib/hal_api/controller/actions.rb', line 10 def index respond_with index_collection, end |
#show ⇒ Object
14 15 16 |
# File 'lib/hal_api/controller/actions.rb', line 14 def show respond_with root_resource(show_resource), end |
#update ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/hal_api/controller/actions.rb', line 27 def update update_resource.tap do |res| consume! res, res res.save! respond_with root_resource(res), end end |