From: David Heinemeier Hansson Date: 2004-07-26T02:50:42+09:00 Subject: Re: rubyonrails and cgikit comparison >> 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 %> -- 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