开发者

Dependencies are apparently not loading correctly after upgrade to Rails 3.1

开发者 https://www.devze.com 2023-04-04 02:29 出处:网络
I\'m in the process of upgrading a Rails 3 project, which uses Devise for authentication, to a Rails 3.1 mountable Engine. After the upgrade, Devise doesn\'t seem to be initialized correctly, raising

I'm in the process of upgrading a Rails 3 project, which uses Devise for authentication, to a Rails 3.1 mountable Engine. After the upgrade, Devise doesn't seem to be initialized correctly, raising a NameError:

uninitialized constant Devise (NameError)

This issue from 2010, which hints at incompatibilities when using Devise outside a regular application environment:

Probably when you are not running it stand-alone, Devise is not being required.

This more recent issue does get into specifics, however it is not about my actual problem (maybe not yet).

I don't quite understand where its coming from. A lot of my dependencies, like CanCan and Compass, started givin开发者_JS百科g me errors at boot after the upgrade. They were all method missing, uninitialized constant and the like. I took this as my chance to either eliminate them or replace them with a more modern alternative. Perhaps I shouldn't have.

Anyone know how to fix this?


Solved the problem by explicitly requiring my dependencies before my Engine's module definition.

require 'devise'
0

精彩评论

暂无评论...
验证码 换一张
取 消