In this question:
How to list all methods for an object in Ruby?
You can call foo.methods
and get all methods. But this does not get all methods. Example in Rails, with ActiveStorage:
Image.first.specimens.first.methods.include?(:variant)
# => false
Image.first.specimens.first.respond_to?(:variant)
# => true
Image.first.specimens.first.variant
Traceback (most recent call last):
1: from (irb):3
ArgumentError (wrong number of arguments (given 0, expected 1))
Image.first.specimens.first.method(:variant)
# => #<Method: ActiveStorage::Attachment(id: integer, name: string, record_type: string, record_id: integer, blob_id: integer, created_at: datetime)#variant>
Given that an ArgumentError is being raised, it respond_to?
s, and I can grab the method, it does have the variant method. But it is not shown with .methods
. How can I see a full list of methods?