Is there a clean way to handle this? I like the idea of avoiding hackery like including view helpers in models for as_json, but the response code changes mean that I'm back to writing out respond_tos manually.
Thanks,
--Matt Jones
Otherwise, you can just rewrite a Responder from scratch, it just
needs to respond to call with three arguments, the controller
instance, and the resource(s) and options passed to respond_with. You
can then set it as the default responder on ApplicationController.
As far as the default Responder is concerned, its algorithm is wrong
in the sense that it will not behave as an API (201 responses and
such) if there’s a template present. I don’t know if it’s possible to
change this without breaking apps out there. Maybe we could build a
better responder next to the old one and leave the choice up to the
user to use it.
[1]: http://api.rubyonrails.org/classes/ActionController/Responder.html#label-Custom+options
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-co...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
>
--
Étienne Barrié