Aliasing Form Helpers

0 views
Skip to first unread message

Elliot Temple

unread,
Sep 1, 2006, 2:37:59 PM9/1/06
to rubyonra...@googlegroups.com
I tried:

module ApplicationHelper
alias_method :orig_text_area, :text_area
def text_area variable, attribute, options={}
options[:cols] ||= 30
options[:rows] ||= 8
orig_text_area(variable, attribute, options)
end
end

But it doesn't do anything. What's the correct way?

(And doesn't answer "CSS", I still want to know how to do aliases)

--
Posted via http://www.ruby-forum.com/.

Elliot Temple

unread,
Sep 1, 2006, 3:11:45 PM9/1/06
to rubyonra...@googlegroups.com
Elliot Temple wrote:
> I tried:
>
> module ApplicationHelper
> alias_method :orig_text_area, :text_area
> def text_area variable, attribute, options={}
> options[:cols] ||= 30
> options[:rows] ||= 8
> orig_text_area(variable, attribute, options)
> end
> end
>
> But it doesn't do anything. What's the correct way?
>
> (And doesn't answer "CSS", I still want to know how to do aliases)

I figured it out, I think. I put a file in lib and required it in
environment.rb. it has:

module ActionView
module Helpers
module FormHelper


alias_method :orig_text_area, :text_area
def text_area variable, attribute, options={}
options[:cols] ||= 30
options[:rows] ||= 8
orig_text_area(variable, attribute, options)
end
end

end
end

Alex Wayne

unread,
Sep 2, 2006, 1:15:11 AM9/2/06
to rubyonra...@googlegroups.com
Elliot Temple wrote:
> module ActionView
> module Helpers
> module FormHelper
> alias_method :orig_text_area, :text_area
> def text_area variable, attribute, options={}
> options[:cols] ||= 30
> options[:rows] ||= 8
> orig_text_area(variable, attribute, options)
> end
> end
> end
> end

Kind of off topic but you use CSS do accomplish that same task without
any extra html markup.

Reply all
Reply to author
Forward
0 new messages