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

Fixes uninitialized constant PaperTrail::RecordTrail::ActiveRecordError #984

Merged
merged 1 commit into from Aug 18, 2017

Conversation

evmorov
Copy link
Contributor

@evmorov evmorov commented Aug 17, 2017

Fixes #663.

I didn't found the right place for the spec so I put it in spec/models/thing_spec.rb:

  describe "#touch_with_version", versioning: true do
    let(:thing) { Thing.new(name: "pencil") }

    context "when record isn't persisted" do
      it "raises an error" do
        expect {
          thing.paper_trail.touch_with_version
        }.to raise_error(ActiveRecord::ActiveRecordError, "can not touch on a new record object")
      end
    end

Without the fix the spec would say:

expected ActiveRecord::ActiveRecordError with "can not touch on a new record object",
got #<NameError: uninitialized constant PaperTrail::RecordTrail::ActiveRecordError> with backtrace:
# ./lib/paper_trail/record_trail.rb:402:in `touch_with_version'

It's the exception I had in the app I'm working on. The message doesn't help so I was forced to look into the code.

@jaredbeck
Copy link
Member

Thanks Evgeny.

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

Successfully merging this pull request may close these issues.

None yet

2 participants