On Jul 14, 2006, at 10:57 AM, Logan Capaldo wrote: > On Jul 14, 2006, at 1:34 PM, Eric Hodel wrote: >> On Jul 14, 2006, at 10:24 AM, Tom Werner wrote: >>> My specific purpose is to write a plugin for Rails that adds an >>> option to each form field helper (the ones that create <input> >>> tags) that specifies an appropriate class (since CSS attribute >>> selector support is lacking in IE). So I'm using code like this: >>> >>> module ActionView >>> module Helpers >>> module FormHelper >>> >>> # text >>> alias_method :__classless_text_field, :text_field >>> def text_field(object_name, method, options = {}) >>> __classless_text_field(object_name, method, options.merge >>> ({:class => (options[:class].to_s + ' text').strip})) >>> end >>> >>> end >>> end >>> end >> >> module X >> def does_something(*options) >> p options >> end >> end >> >> module Y >> def does_something(*options) >> super('x', *options) >> end >> end >> >> class C >> include X >> include Y >> end >> >> C.new.does_something 'foo' > > Rails does "funny" things. These helpers are usually used from > within eruby templates e.g: > > <html> > <%= text_field( ... ) %> > </html> > > Rails sets up the context in which the templates are executed. He'd > have to go into the actual rails source to fix this. OTOH... This is what ActionController::Base::helper is for. -- Eric Hodel - drbrain / segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com