can anyone tell me how to call link_to from within a model class? I’m
trying to do something like the following:
validates_uniqueness_of :email, :message => “address has already
been taken. If you’ve forgotten your password, please click " +
link_to(‘here’, :action => ‘forgot_password’, :controller => ‘site’) +
" to reset it.”
although I get the following error when it attempts to validate a form:
Session contains objects whose class definition isn’t available.
Remember to require the classes for all objects kept in the session.
(Original exception: undefined method `link_to’ for User:Class
[NoMethodError])
I’ve also tried doing:
class User < ActiveRecord::Base
include ActionView::Helpers::UrlHelper
…
but calling link_to produces the same error… I’ve also tried:
validates_uniqueness_of :email, :message => "address has already
been taken. If you’ve forgotten your password, please click " +
ActionView::Helpers::UrlHelper:link_to(‘here’, :action =>
‘forgot_password’, :controller => ‘site’) + " to reset it.
but that gives me:
Session contains objects whose class definition isn’t available.
Remember to require the classes for all objects kept in the session.
(Original exception: undefined method `link_to’ for
ActionView::Helpers::UrlHelper:Module [NoMethodError])
if anyone can help me, I’d really appreciate it… Thanks,
Mike