Search code examples
ruby-on-railsruby-on-rails-3viewroutesactiondispatch

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!


Solution

  • Path of the Request:

    request.path
    

    Path of the file:

    __FILE__