title: How can I overwrite a getter method in an ActiveRecord model?
body: <p>I'm trying to overwrite a getter method for an ActiveRecord model. I have an attribute called <code>name</code> in the model <code>Category</code>, and I'd like to be able to do something like this:</p>
  
  <pre><code>def name
    name_trans || name
  end
  </code></pre>
  
  <p>If <code>name_trans</code> attribute is not nil, then return it, else return <code>name</code> attribute. How would I do this?</p>
  
  <p>This should then be called normally like this:</p>
  
  <pre><code>@category.name
  </code></pre>