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 #983

Closed
wants to merge 0 commits into from

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.

If you point me the right place for a spec I will add it.

@jaredbeck
Copy link
Member

Thanks Evgeny. A spec would be nice, but isn't necessary for such a simple change.

Please add an entry to CHANGELOG.md under Unreleased > Fixed.

Copy link
Member

@jaredbeck jaredbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes: Changelog entry

@evmorov evmorov closed this Aug 17, 2017
@evmorov
Copy link
Contributor Author

evmorov commented Aug 17, 2017

Oops. I accidentally closed it. New PR is here #984

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