From: David Heinemeier Hansson Date: 2004-07-26T02:10:51+09:00 Subject: Re: rubyonrails and cgikit comparison > Wouldn't that result in a very long tag, and thus more difficult to > read, in a Rails template? > I don't doubt you can make the same component, if you pass all > arguments in the template, it become hard tom read the template. Maybe > you can pass all arguments in the code, but then you have to take the > discipline to keep all the code in the same place. With bindings, you > know exactly where you pass the arguments. You would use helpers for this stuff. So you could have a generic TableHelper and then have your specific EmployeesHelper: class TableHelper def table(source, options = {}) # construct an HTML table based on the options end end class EmployeesHelper def payroll_table(payroll, additional_options = {}) options = DEFAULT_OPTIONS_FOR_PAYROLL_TABLE.merge(additional_options) table(payroll, options) end end 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. -- 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