Module: Trax::Controller::Actions
- Extended by:
- ActiveSupport::Concern
- Included in:
- Trax::Controller
- Defined in:
- lib/trax/controller/actions.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/trax/controller/actions.rb', line 17 def create create! do |success, failure| success.json do render_resource(201) end failure.json do render_errors(:unprocessable_entity, *resource.errors.) end end end |
#destroy ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/trax/controller/actions.rb', line 41 def destroy destroy! do |success, failure| success.json do render_resource end failure.json do render_errors(:method_not_allowed, *[:errors]) end end end |
#index ⇒ Object
10 11 12 13 14 15 |
# File 'lib/trax/controller/actions.rb', line 10 def index render :json => collection, :meta => , :each_serializer => collection_serializer, :root => collection_root end |
#show ⇒ Object
53 54 55 |
# File 'lib/trax/controller/actions.rb', line 53 def show render_resource end |
#update ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/trax/controller/actions.rb', line 29 def update update! do |success, failure| success.json do render_resource end failure.json do render_errors(:unprocessable_entity, *resource.errors.) end end end |