I'm transforming a Rails application (say appA) into engine so that I can hook it into another Rails app (say appB). However appA must run as a Rails app solely as well. That's because a customer can buy
- appA or
- appB with appA. There is no option of buying only appB.
Following rails oficial guide I made (among others) following changes:
- Changed
Rails.application.routes.draw
toActionPlan::Engine.routes.draw
inroutes.rb
. Created
lib/action_plan/engine.rb
with content shown below:module ActionPlan class Engine < ::Rails::Engine isolate_namespace ActionPlan end end
Now when I run rails s
I get /action_plan/config/routes.rb:1:in '<top (required)>': uninitialized constant ActionPlan::Engine (NameError)
.
I guess I should initialize ActionPlan::Engine
in application.rb
file somehow but I don't know how neither whether it's the way to go.
So is it possible to build an app/engine in rails such as appA? If it is, how can I overcome that problem?
After some researching and talking to some friends, I found out that it's not possible to do such a think with rails, but it's possible you to create another rails app (say appC) and use it only to run your engine, i.e appC is a silly rails app used only to make it possible to run your engine.