title: How to get url_for an object in Model method in Rails
body: <p>I would like to create a string that include a path for an object in Rails. </p>
  
  <pre><code>  def notification_content   
        "#{app.listing_url(my_listing, :host =&gt; "example.com")}. " +
    end
  </code></pre>
  
  <p>This content will then be fed into my ActionMailer as email content.</p>
  
  <p>In console, it works fine. However, when I run it on localhost server, I get the following error:</p>
  
  <pre><code>undefined local variable or method `app'
  </code></pre>
  
  <p>How should I go about it? Also, how can I make the path to be a hyperlink?</p>
  
  <p>Thanks a lot.</p>