Gudleik Rasch 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]

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to