Using a named route from elsewhere in RoR

Hi Everybody,

I’m trying to use named routes (method foo_url where foo is the route).
I’m trying to call the method from inside a Liquid tag definition, so
the class is not a subclass of ActionController

foo_url gets a no method error

ActionController::Routing::Routes.foo_url and
have the same error.

trying script/console:
ActionController::Routing::Routes.named_routes[:foo] (note: no _url)
gives me a ActionController::Routing::Route object. So I know the route
is there.

But how do I invoke it or make use of it?

Ideas much appreciated.

Regards from New York City,


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs