Issue with Version.method_defined? :object_changes #74

vkhater opened this Issue Jul 22, 2011 · 7 comments

3 participants



In development mode Version.method_defined? :object_changes always seems to be returning false. Can we use Version.column_names.include?("object_changes") instead? Something I am missing here?

>> Version.method_defined? :object_changes
>>  => false

BTW. Great plugin. Appreciate the work you have put in to it.


Funnily enough looking into method_defined? is already on my to-do list. It was introduced in a recent pull request and, since it passed the tests, I accepted it while deferring my checking until later. It seems I was too lazy! Sorry about that.

I'm running out the door now but I'll fix this up later on when I get back. I'll either go with your suggestion or responds_to?.


Yes, it's strange. I have also this issue in my development environment but 'with-changes' feature works fine.

Version.method_defined? :object_changes
=> false
=> {"post_id"=>[1, 10]} 

@vkhater, 'with-changes' feature work for you?

I agree that Version.column_names.include?("object_changes") or respond_to? maybe will be better.


@edtsech, my guess to Version.find(46).changeset works fine is since the Version class is already instantiated. Even this works..
Version.method_defined? :obect_changes
=> true
@edtsech edtsech added a commit to edtsech/paper_trail that referenced this issue Jul 22, 2011
@edtsech edtsech #74: Changed method_defined? to column_names.include? & Fix test for …
…case without object_changes column

Added pull request #75, hope it closes this issue.

@airblade airblade added a commit that referenced this issue Jul 23, 2011
@airblade Merge branch '74_method_defined' of…
…trail into edtsech-74_method_defined

* '74_method_defined' of
  #74: Changed method_defined? to column_names.include? & Fix test for case without object_changes column

Thanks to @edstech's pull request, this should be fixed in v2.2.9.

@airblade airblade closed this Jul 23, 2011

Thanks @airblade and @edtsech for the fix :)


Thank you for report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment