title: When to use `self.foo` instead of `foo` in Ruby methods
body: <p>This is not specific for Rails - I am just using Rails as an example. </p>
  
  <p>I have a model in Rails:</p>
  
  <pre><code>class Item &lt; ActiveRecord::Base
  
    def hello
      puts "Hello, #{self.name}"
    end
  end
  </code></pre>
  
  <p>(Let's assume that the <code>Item</code> model (class) has a method called <code>name</code>.) When do I need to use <code>self.name</code> and when can I just use <code>name</code> (e.g., <code>#{name}</code>)?</p>