Novneet Nov
Novneet Nov

Reputation: 592

How to recongnise routes in a Rails App

I have this very basic question. I am using this dashboard rails engine, and this gives me a views/layouts/dashing/dashboard.html.erb. This is the layout of the dashboard view.

But I want to customize this view, like add a navigation bar, that has a link which point to my about_path. However, none of the routes are recognized in the dashboard view. It results in an error undefined method about_path.

But the about_path route is defined in my routes file and is working fine in other views that dont belong to dashboard.

Is there any way a rails engine recognizes routes defined in my application?

Upvotes: 3

Views: 85

Answers (1)

widjajayd
widjajayd

Reputation: 6263

If you wish to reference the application inside the engine in a similar way, use the main_app helper:

<%= link_to "About", main_app.about_path %>

here is link for reference rails routes guide

Upvotes: 5

Related Questions