After installing paper_trail, get "irb: warn: can't alias context from irb_context." from rails console
Asked Answered
C

2

13

I've tested this by running rails c both before and after git stash. On Rails 4.1 in Mavericks, after following the instructions to add the versions table and adding has_paper_trail to three models, whenever I run rails c I get

irb: warn: can't alias context from irb_context.

I've spent some time Googling without much luck, there's old threads talking about rspec, but I don't see how that's relevant since I'm not using it. Any ideas why this is happening?

Ciel answered 10/6, 2014 at 5:0 Comment(1)
There is an open issue for this on GitHub github.com/airblade/paper_trail/issues/381Airiness
C
2

This is now fixed in papertrail 4.0.0, here's the commit.

Ciel answered 22/10, 2015 at 20:17 Comment(0)
C
2

RSpec used to polute provide Object top-level methods, e.g. describe, context, etc. Fortunately they've got rid of all the monkey patching in version 3, and now all these methods are namespaced under RSpec.

One can change this behaviour through the expose_dsl_globally config flag. For backwards compatibility, it defaults to true.

The warning shows up when you open the console because paper_trail automatically loads its rspec helpers when rspec is found. And it calls RSpec.configure before you have the chance to tweak your own configuration.

One possible solution would be paper_trail to disable the automatically loading and let users to load it themselves when they see fit. However, I am not aware of the internals of the library, so I can't guarantee this wouldn't break other things.

Best!

Cuirass answered 26/7, 2014 at 16:30 Comment(0)
C
2

This is now fixed in papertrail 4.0.0, here's the commit.

Ciel answered 22/10, 2015 at 20:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.