Issue with Version.method_defined? :object_changes #74

Closed
vkhater opened this Issue Jul 22, 2011 · 7 comments

3 participants

@vkhater

Hi,

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.

@airblade
Owner

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?.

@edtsech

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
Version.find(46).changeset
=> {"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.

@vkhater

@edtsech, my guess to Version.find(46).changeset works fine is since the Version class is already instantiated. Even this works..

Version.new
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
be2ff20
@edtsech

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 https://github.com/edtsech/paper_…
…trail into edtsech-74_method_defined

* '74_method_defined' of https://github.com/edtsech/paper_trail:
  #74: Changed method_defined? to column_names.include? & Fix test for case without object_changes column
2e49b5a
@airblade
Owner

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

@airblade airblade closed this Jul 23, 2011
@vkhater

Thanks @airblade and @edtsech for the fix :)

@edtsech

Thank you for report!

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