Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paper_trail doesn't seem to work with acts-as-taggable-on #224

Closed
aaronjensen opened this issue May 16, 2013 · 8 comments
Closed

paper_trail doesn't seem to work with acts-as-taggable-on #224

aaronjensen opened this issue May 16, 2013 · 8 comments
Milestone

Comments

@aaronjensen
Copy link

paper_trail tries to set the fake attributes that acts-as-taggable-on uses resulting in:


ActiveModel::MissingAttributeError: can't write unknown attribute `tag_list'
    vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/attribute_methods/write.rb:45 • write_attribute
    vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/attribute_methods/dirty.rb:70 • write_attribute
    vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/attribute_methods.rb:317 • []=
    vendor/bundle/ruby/2.0.0/bundler/gems/paper_trail-6d446564d92e/lib/paper_trail/has_paper_trail.rb:266 • block (2 levels) in item_before_change
    vendor/bundle/ruby/2.0.0/bundler/gems/paper_trail-6d446564d92e/lib/paper_trail/has_paper_trail.rb:266 • each
    vendor/bundle/ruby/2.0.0/bundler/gems/paper_trail-6d446564d92e/lib/paper_trail/has_paper_trail.rb:266 • block in item_before_change
    vendor/bundle/ruby/2.0.0/bundler/gems/paper_trail-6d446564d92e/lib/paper_trail/has_paper_trail.rb:264 • tap
    vendor/bundle/ruby/2.0.0/bundler/gems/paper_trail-6d446564d92e/lib/paper_trail/has_paper_trail.rb:264 • item_before_change
    vendor/bundle/ruby/2.0.0/bundler/gems/paper_trail-6d446564d92e/lib/paper_trail/has_paper_trail.rb:208 • record_update 
@batter
Copy link
Collaborator

batter commented May 16, 2013

Can you please provide more detailed information on how to reproduce this? Just attempted to and was unable to do so.

@aaronjensen
Copy link
Author

Sure, sorry. This would need a test_models table.

class TestModel < ActiveRecord::Base
  acts_as_taggable
  has_paper_trail
end

describe TestModel do
  it "is broken" do
    PaperTrail.enabled = true
    model = TestModel.new tag_list: 'foo, bar'
    model.save!

    model.update_attributes(tag_list: 'bar, baz')
  end
end

I'm not sure if these specific versions are necessary or not, but I'm on rails 4 and ruby 2, so this is an excerpt from my Gemfile:

ruby '2.0.0'

gem 'rails', '4.0.0.rc1'
# Rails 4 support, pending release of 2.4.1
gem 'acts-as-taggable-on', github: 'mbleigh/acts-as-taggable-on'
# Rails 4 support
gem 'paper_trail', github: 'airblade/paper_trail', ref: 'rails4'

@aaronchi
Copy link

I'm also seeing this

@chrisvariety
Copy link

I believe this fix only made it into the master branch, is it possible to get it into the rails4 branch as well? Thanks!

@batter
Copy link
Collaborator

batter commented Jul 19, 2013

@speedmanly - Just merged it into the rails4 branch, you should be good to go.

@chrisvariety
Copy link

@fullbridge-batkins Thanks so much!!

@dhruvbhatia
Copy link

Seems paper_trail doesn't track tag list changes under Rails 5. I think it may have something to do with API changes, as per this issue.

Anybody else experiencing this?

@jaredbeck
Copy link
Member

Seems paper_trail doesn't track tag list changes under Rails 5.

Hi Dhruv, I was just discussing this with someone on S.O. (https://stackoverflow.com/questions/45156752/rails-how-to-enable-papertrail-auditing-for-tags)

Two suggestions: 1. use Version Metatadata (github.com/airblade/paper_trail#4c-storing-metadata) 2. use Association Tracking (github.com/airblade/paper_trail#4b-associations)

I haven't heard back from them if they tried either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants