From: Gavin Sinclair Date: 2004-07-13T07:08:26+09:00 Subject: Re: can't override a cgi function, please help On Tuesday, July 13, 2004, 8:02:35 AM, Cere wrote: > This is soooo driving me crazy! > I'm just trying to override the checkbox function on the CGI ruby > library and can not. Can someone tell me what I am doing wrong? > Simply: > require 'cgi' > class << CGI > def checkbox(name="",val=nil,checked=nil) > puts "asdf" > puts @params[name] > end > end > cgi=CGI.new('html3') > cgi.out() do > cgi.html() do > cgi.body() do > cgi.form("get") do > cgi.checkbox('box','true',"checd") + > cgi.br + > cgi.submit("Okey Dokey?") > end > end > end > end You're creating/overriding a *class* method of CGI, not an *instance* method. Try -- with the code above -- calling 'CGI.checkbox(...)' and see what happens. Do this: class CGI def checkbox(...) ... end end Cheers, Gavin