With Rails 3
you need to include ActionView :: Helpers :: UrlHelper in your model and define a message, for example, a lambda that needs to be interpreted if necessary
class XXX < AR
extend ActionView::Helpers::UrlHelper
validates_acceptance_of :not_an_agency, :on => :create,
:message => lambda {"must be confirmed. If you are an agency please #{link_to "Contact Us", contact_path}"}
end
With Rails 2
this is the same, but you need to define: host every time.
class XXX < AR
extend ActionView::Helpers::UrlHelper
validates_acceptance_of :not_an_agency, :on => :create,
:message => lambda {"must be confirmed. If you are an agency please #{link_to "Contact Us", contact_path(:host => 'http://example.org')}"}
end
source
share