The issue here really lies in reusable subcomponents of functionality, of any granularity of your choosing (i.e. objects)<br><br>Presently helpers are your best bet in this respect, but what happens when you have something so complex it needs to retain state? In that case, the procedural approach exposed by the helper API grows increasingly insufficient.
<br><br>- Tony<br><br><div><span class="gmail_quote">On 5/18/07, <b class="gmail_sendername">David Clements</b> <<a href="mailto:david@collectiveintellect.com">david@collectiveintellect.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Not sure if I am totally following the issue here. I totally agree<br>with the premise that the support for widgetizing our apps is really<br>ugly. And I use components regularly to widgetize various portions of<br>our apps.
<br><br>Are we talking about syntax or functionality?<br><br>We could re-write your example today using render_component_as_string:<br><br>class FooController < ApplicationController<br> def bar<br> # get a handle on, and parameterize, a bar controller
<br> bar_controller = component_for(:controller => 'bar') do<br> @foo = 42<br> @bar = 'forty-two'<br> end<br><br> # call two actions on the bar controller, potentially reusing<br>
the entire model+view+controller stack<br> foo = bar_controller.content_for :action => 'foo'<br> bar = bar_controller.content_for :action => 'bar'<br><br> render :text => [foo, bar].inspect #=> [42, "forty-two"]
<br> end<br>end<br><br><br>With this:<br><br>class FooController < ApplicationController<br> def bar<br> params_hash = {:foo => 42, :bar => 'forty_two'}<br><br> # call two actions on the bar controller, potentially reusing
<br>the entire model+view+controller stack<br> foo = render_component_as_string( params_hash.merge(:controller<br>=> "bar", :action => "foo" )<br><br> bar = render_component_as_string( params_hash.merge(:controller
<br>=> "bar", :action => "bar" )<br><br> render :text => [foo, bar].inspect #=> [42, "forty-two"]<br> end<br>end<br><br><br>Not sure if I am missing something, as I didn't here Bruce's talk
<br>last week,<br><br>Dave<br><br><br><br><br>On May 18, 2007, at 4:41 PM, Peter Jones wrote:<br><br>ara.t.howard wrote the following on Fri, May 18, 2007 at 02:16:54PM<br>-0600:<br>> i'd love feedback from the community
<br><br><br>Ara, this stuff looks pretty good. Like you, I tend to gravitate<br>towards OOP,<br>and it's disappointing that with Rails, MVC is only 1/3 OO. I'm<br>wondering if<br>it's time to rethink ActionController and ActionView a bit.
<br><br><br><br><br><br><br>--<br>Peter Jones - 303-669-2637<br>pmade inc. - <a href="http://pmade.com">http://pmade.com</a><br>_______________________________________________<br>Bdrg-members mailing list<br><a href="mailto:Bdrg-members@rubyforge.org">
Bdrg-members@rubyforge.org</a><br><a href="http://rubyforge.org/mailman/listinfo/bdrg-members">http://rubyforge.org/mailman/listinfo/bdrg-members</a><br><br>_______________________________________________<br>Bdrg-members mailing list
<br><a href="mailto:Bdrg-members@rubyforge.org">Bdrg-members@rubyforge.org</a><br><a href="http://rubyforge.org/mailman/listinfo/bdrg-members">http://rubyforge.org/mailman/listinfo/bdrg-members</a><br></blockquote></div><br>
<br clear="all"><br>-- <br>Tony Arcieri<br>ClickCaster, Inc.<br><a href="mailto:tony@clickcaster.com">tony@clickcaster.com</a><br>720-227-0129 ext. 202