How to run a Rails engine with Pow
If you are a beginner and you ever had the need to run a Rails engine separately from your dummy app, you might have tried this:
bundle exec rails s
But if you did like that you will see this error:
Error: Command not recognized Usage: rails COMMAND [ARGS] The common Rails commands available for engines are: generate Generate new code (short-cut alias: "g") destroy Undo code generated with "generate" (short-cut alias: "d") All commands can be run with -h for more information. If you want to run any commands that need to be run in context of the application, like `rails server` or `rails console`, you should do it from application's directory (typically test/dummy).
This would be expected, because it is not a full app, it doesn't contain all the configuration files to run from the root route, to fix that you need to run the server inside the following directory:
Once you understand this, we'll try to run this engine with Pow. If you don't know what Pow is, you can visit the project's homepage. You could also take a look at this blog post by a fellow Colleage.
So, as I was trying to explain, you need to create a symlink for your app doing this:
ln -s /path/to/myapp
Now if you go to your browser and go to this address:
You will be able to see your engine app
If you're using RVM, and you did all the steps but you're seeing an error like this:
LoadError: no such file to load -- bundler/setup
Then that means that you are experiencing an issue related to the new RVM version. The only thing you need to do is run this line inside
rvm env -- [ruby]@[gemset] > .powenv
It will solve the problem, now you just need to restart POW and it will work.
Thanks for reading!