Nepal on Rails

millisami's rants!

Using Rails Route Helpers Inside Engine

In a Rails app, we can access the route helpers calling methods on Rails.application.routes.url_helpers or by including the module include Rails.application.routes.url_helpers

But inside an engine, it will not work. For this we’ve to use the engine’s url_helpers module.

1
MyApp::Engine.routes.url_helpers.new_post_path

Assuming that the engine have a post resource.

Comments