How do I get the path to a resource in the model? I need to store it in the database and would like the same url as you get from resourcename_path(resource)
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In Rails 3, you can include the url helpers in models (though it normally is not the best way of dealing with things):
In Rails 2, I think it’s
include ActionController::UrlWriter, but I can’t remember. Google is your friend.