jakobk
jakobk

Reputation: 1132

Rails mountable engine and devise

I have a mountable rails engine with Devise. When I copy my migrations and run rake db:migrate in the dummy app it works just fine.

But when I use a new rails app, add my engine to the gem file, copy migrations and run rake db:migrate I get this error "uninitialized constant Devise".

I have this in my routes file:

mount Cms::Engine, :at => '/', :as => 'cms'

What am I doing wrong ?

Upvotes: 2

Views: 1145

Answers (1)

Tim Fletcher
Tim Fletcher

Reputation: 7386

I think you need to explicitly require devise in your engine's engine.rb file.

From the Rails guides:

Note that if you want to immediately require dependencies when the engine is required, you should require them before the engine's initialization. For example:

So just add require 'devise' to the top or your engine.rb.

Upvotes: 1

Related Questions