title: When to use self in Model?
body: <p>Question: when do I need to use self in my models in Rails?</p>
  
  <p>I have a <code>set</code> method in one of my models.</p>
  
  <pre><code>class SomeData &lt; ActiveRecord::Base
    def set_active_flag(val)
      self.active_flag = val
      self.save!
    end
  end
  </code></pre>
  
  <p>When I do this, everything works fine. However, when I do this: </p>
  
  <pre><code>class SomeData &lt; ActiveRecord::Base
    def set_active_flag(val)
      active_flag = val
      save!
    end
  end
  </code></pre>
  
  <p>The active_flag value doesn't change, rather it fails silently. Can someone explain? </p>
  
  <p>I can't find any duplicates, but if someone finds one that's fine too.</p>