> 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.

Reply via email to