I have a view, which wants to consume information from a presentation model. This model contains among other things, a collection of ActiveRecord objects.
I would like to not expose the entire collection to the models consumers, but instead wish to only expose the 'data' part.
I expect that I can write a method to create a data-only copy of this complex object, but I'll be honest, I don't reall开发者_StackOverflow中文版y want to.
Is it a terrible idea for me to just expose the entire collection object (yeah, along with all its extra methods and properties...and potential for badness)?
Or, maybe, there's a better approach to dealing with this kind of scenario? I'm sure I'm not the first guy to run into this.
--Brian
I do not think exposing control calls to a view is always bad. Here is sounds like it would be a simpler solution to do so than creating the data proxies (data proxies can have errors, get out of date, and create code duplication).
精彩评论