Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you use ActionDispatch::Routing::RouteSet recognize_path?

How do you use ActionDispatch::Routing::RouteSet recognize_path?

I want to get the current path for the view.

I tried <div id="<%= ActionDispatch::Routing::RouteSet::recognize_path %>"> but got "undefined method `recognize_path' for ActionDispatch::Routing::RouteSet:Class".

Thanks!

like image 343
B Seven Avatar asked Jan 19 '23 09:01

B Seven


1 Answers

You can do this

Rails.application.routes.recognize_path "/your/path"

It works in rails 3.1.0.rc4

like image 92
Lucas Renan Avatar answered Jan 30 '23 01:01

Lucas Renan