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 _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
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 Hutchings phillip.hutchings-QrR4M9swfipWk0Htik3J/w@public.gmane.org
On Dec 11, 2005, at 4:49 PM, rails-request-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org wrote:> 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.I''m not sure if this is what you''re looking for, but I solve the problem of "What''s the URL for this model object?" like this: http://blog.zenspider.com/archives/2005/12/overriding_url.html -- Eric Hodel - drbrain-48TerJ1FxhPk1uMJSBkQmQ@public.gmane.org - http://segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com