Accessing url_for from a custom helper classccdaææææøøøæøæ"¥00

I have some custom helper classes under lib/ that need to access the
routes (link_to/url_for/etc):

But when I call <%= magic_link Product.first %> from the view it renders
the error

Gudleik R. wrote in post #966781:

I have some custom helper classes under lib/ that need to access the
routes (link_to/url_for/etc):
http://gist.github.com/520529

But when I call <%= magic_link Product.first %>

NEVER DO THAT! Product.first does a database call. Therefore, it
should never be used in the view. The view should never, ever touch
the database under any circumstances. Instead, make the database call
in the controller and set an @instance variable.

from the view it renders

the error

What error?

You’ll probably need to include ActionController::UrlWriter in your
helper.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]