Forum: Ruby on Rails method_exists? is missing?

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.
James B. (Guest)
on 2009-04-09 21:16
In a controller run through webrick I do this:

 @entity = Entity.new
 print @entity.methods.sort.to_yaml

and I see this:

- logger
- mark_for_destruction
- marked_for_destruction?
- metaclass
- method
- method_missing
- methods
- new_record?

There is no method_exists? method.  If I instead do this in a console
session, I see this:

$ script/console
>>
>>  @entity = Entity.new
=> ...
>>  print @entity.methods.sort.to_yaml
...
- logger
- mark_for_destruction
- marked_for_destruction?
- metaclass
- method
- method_exists?
- method_missing
- methods
- mocha
- mocha_inspect
- new_record?
...

However, if I remove the mocha gem (0.9.5) then method_exists?
disappears from Entities created in the console as well.

So, what gives?
James B. (Guest)
on 2009-04-09 22:42
James B. wrote:

> So, what gives?

Turns out I should be using #respond-_to? instead.  Method_missing? is
part of mocha.
This topic is locked and can not be replied to.