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?

Waynn Lue
  • 11,344
  • 8
  • 51
  • 76

2 Answers2

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!

wicz
  • 2,315
  • 12
  • 13
2

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

Waynn Lue
  • 11,344
  • 8
  • 51
  • 76