Class: Tim::CustomResponder
- Inherits:
-
ActionController::Responder
- Object
- ActionController::Responder
- Tim::CustomResponder
- Defined in:
- app/responders/tim/custom_responder.rb
Instance Method Summary collapse
-
#api_behavior(error) ⇒ Object
We want different API Behaviour than in default renderer.
Instance Method Details
#api_behavior(error) ⇒ Object
We want different API Behaviour than in default renderer
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/responders/tim/custom_responder.rb', line 4 def api_behavior(error) raise error unless resourceful? status = :ok begin if get? then display resource elsif post? status = :created controller.render :status => status, :action => "show" elsif put? controller.render :status => :ok, :action => "show" else head :no_content end rescue ActionView::MissingTemplate => e display resource, :status => status end end |