0

I have a class like this in a rails app

class User < ActiveRecord::Base
  ..
end

The class doesn't have a method caller foo? Nor does any of the include ... files. But User.new.foo? does respond, so how can I ask where this method is defined?

american-ninja-warrior
  • 7,397
  • 11
  • 46
  • 80

1 Answers1

2
(byebug) User.last.method(:foo?)
#<Method: User(#<Module:0x007fd4c0a03da8>)#foo?>
(byebug) User.last.method(:foo?).source_location
["/Users/user1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7/lib/active_record/enum.rb", 122]
(byebug) 
american-ninja-warrior
  • 7,397
  • 11
  • 46
  • 80