title: Rails 5: error passing time_ago_in_words from controller to view
body: <p>I want to prevent users from deleting comments that are more than X minutes old. (This is determined by a status field.) I anticipate that the value of X may change in future so it's currently defined in an initializer:</p>
  
  <pre><code>AGE = 1.minute 
  </code></pre>
  
  <p>What's the best way to pass the error message from the Comment controller to the (Server-generated Javascript Response) view?</p>
  
  <pre><code>if @comment.status == "locked"
    render "comments/too-old", locals: {message: "You can't delete this comment now as it's more than #{time_ago_in_words(AGE.ago)} old."}
  end
  </code></pre>
  
  <p>This currently fails as we're not allowed to use <strong>time_ago_in_words</strong> in a controller:</p>
  
  <blockquote>
    <p>undefined method `time_ago_in_words'</p>
  </blockquote>