Using named routes in a model


#1

I have searched this list for an answer, can’t find one.

Does anybody know a way to use named routes (or url_for, if need be) to
generate a url that i can use for a Model? The generated convenience
methods, even url_for itself, seem to only be available in
ActionController
and ActionView.

Thanks,

Lee


All that is gold does not glitter.
Not all those who wander are lost.
The old who are strong do not whither.
Deep roots are not touched by the frost.
– J.R.R. Tolkein


#2

On 12/12/2005, at 1:39 PM, Lee Pope wrote:

Does anybody know a way to use named routes (or url_for, if need
be) to generate a url that i can use for a Model? The generated
convenience methods, even url_for itself, seem to only be available
in ActionController and ActionView.

That is quite right, because models aren’t supposed to know about
URLs. Models encapsulate business rules, URLs are controller/view
elements. What you probably want is a helper.


Phillip H.
removed_email_address@domain.invalid