using route resource in the model

How would i go about using a mapped resource in my model?

eg. # routes file map.resources :questions

# model def after_create     notification = UserNotification.new(:user => current_user)     notification.body = 'You posted a new <a href="' + question_url(question.id) + '">question</a>'     notification.save end

comes up saying undefined method for question_url

Well, since url helpers are UI constructs, they really shouldn't be used directly by models. They are available in controllers and views.

I'd humbly suggest that the best way to solve this is to have the UserNotification have a reference to the question, and then use question_url in UserNotificationsController and/or it's views.

This would properly keep the M-VC business logic-ui separation.

mmm ok thanks the help