Note that my presenters are also broken up by API version to match the controller, i.e Api::V1::FooPresenter.
On 22 August 2011 21:47, Ian Leitch <[email protected]> wrote: > Yeah, that's what I've started doing... though I'm calling them > Presenters. Should have been obvious to me this was a view layer > problem instead of a model one! > > On 22 August 2011 21:37, Steve Hoeksema <[email protected]> wrote: >>> I'm almost considering a layer in between my controllers and models, >>> almost like a presentation layer from model to controller. Mixins >>> could help here... perhaps something like this? >>> https://gist.github.com/1162618 >>> Could get messy if the controller uses a large number of models? >>> Thoughts welcome! >> >> I posted on this list with the same problem late last year, and ended up >> doing just this. >> >> I tried using built-in views but it seemed like more trouble than it was >> worth, particularly to render either a JSON object or an array of JSON >> objects without hacks or duplicating code. >> >> It ended up something like this: https://gist.github.com/1163453 >> >> Each service I needed to present an object to got its own class, and >> implemented as_json, as_xml, as_kml, etc. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby or Rails Oceania" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/rails-oceania?hl=en. >> >> > -- You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.
