On Friday 08 December 2006 19:12, Rich Collins wrote:
> I kind of pushed it out early as I heard something called presenters
> were being considered. It was not really ready for external use, but
> I wanted to put it out there to join the impending conversation about
> OO helpers.
> I think we need to move
> away from functional style helpers and toward a more OO solution.
This mindset is what kept me from dismissing the idea altogether. I
completely agree that there has to be something more elegant than
sticking together helper methods (functions!) in a barely cohesive
lump.
Now, the question is whether the model objects are the right place to
put helper methods (always assuming, of course, that separation of
concerns is maintained). Presenters are another option. I think it
largely depends on whether and where polymorphism is needed.
In the past, I have at times wished for a feature in Ruby/Rails for
scoping mixins dynamically. Something like this
<% with_mixin Person => BriefDisplayPersonMixin,
Address => BriefDisplayAddressMixin do -%>
<% models.each do |m| -%>
<%= m.display %>
<% end -%>
<% end -%>
What I'm envisioning here is that the mixed in features are only
available during the execution of the block. It might even be useful to
confine the mixin to only specific objects instead of the class itself.
But that's all pretty baseless speculation on my part.
(Statically scoping mixins would be useful in its own right to keep
independent extensions of core or rails classes from treading on each
others feet.)
Michael
--
Michael Schuerig
mailto:[EMAIL PROTECTED]
http://www.schuerig.de/michael/
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---