Forum: Ruby on Rails How to overwrite a method?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Scott A. (Guest)
on 2008-11-07 13:15
Hi,

The following file within rails
/activeresource/lib/active_resource/formats/xml_format.rb

Has the method
def extension
   "xml"
end

How can I overwrite this so that it returns PHP without editing any core
file?

Thanks
Frederick C. (Guest)
on 2008-11-07 13:17
(Received via mailing list)
On 7 Nov 2008, at 11:15, Scott A S wrote:

>
> How can I overwrite this so that it returns PHP without editing any
> core
> file?
>
just reopen that class
class WhateverItIs
   def extension
     "php"
   end
end
This topic is locked and can not be replied to.