From: Bauduin Raphael Date: 2004-07-26T03:01:53+09:00 Subject: Re: rubyonrails and cgikit comparison David Heinemeier Hansson wrote: >>> So the EmployeesHelper is basically just a preconfigured version of >>> the generic table. And in the template you'd just have: >>>

Employee payroll

>>> <%= payroll_table(@payroll) %> >>> That's pretty clean to me. >> >> >> That just leaves the reuse of a binding in several places in the >> template as unanswered. > > > By binding, do you mean @payroll? If you don't want that left to the > template, just include it in the helper method. So you would use: > > def payroll_table(additional_options = {}) > options = DEFAULT_OPTIONS_FOR_PAYROLL_TABLE.merge(additional_options) > table(@payroll, options) > end > > Notice that you can reference all the variables available to the > template in the helpers. Now you're down to: > > <%= payroll_table %> OK, I'll try to develop a component for rails to see by myself. Thanks for your explanations. Raph > -- > David Heinemeier Hansson, > http://www.rubyonrails.org/ -- Web-application framework for Ruby > http://www.instiki.org/ -- A No-Step-Three Wiki in Ruby > http://www.basecamphq.com/ -- Web-based Project Management > http://www.loudthinking.com/ -- Broadcasting Brain > http://www.nextangle.com/ -- Development & Consulting Services > > >