title: Rails: Use URL Helper in Observer
body: <p>I have an observer which looks like this:</p>
  
  <pre><code>class CommentObserver &lt; ActiveRecord::Observer
      include ActionView::Helpers::UrlHelper
  
      def after_create(comment)
          message = "#{link_to comment.user.full_name, user_path(comment.user)} commented on #{link_to 'your photo',photo_path(comment.photo)} of #{comment.photo.location(:min)}"
          Notification.create(:user=&gt;comment.photo.user,:message=&gt;message)
      end
  
  end
  </code></pre>
  
  <p>Basically all I'm using it to do is create a simple notification message for a certain user when someone posts a comment on one of their photos.</p>
  
  <p>This fails with an error message:</p>
  
  <pre><code>NoMethodError (undefined method `link_to' for #&lt;CommentObserver:0x00000102fe9810&gt;):
  </code></pre>
  
  <p>I would have expected including <code>ActionView::Helpers::UrlHelper</code> would solve that, but it seems to have no effect.</p>
  
  <p>So, how can I include the URL helper in my observer, or else render this some other way? I would happily move the "message view" into a partial or something, but an observer has no associated views to move this to...</p>