title: ruby alias_method question
body: <p>I have following code</p>
  
  <pre><code>class User
    attr_accessor :name
  end
  
  u = User.new
  u.name = 'john'
  puts u.name #=&gt; john
  </code></pre>
  
  <p>In the above case everything works. However this code does not work</p>
  
  <pre><code>class User
    attr_accessor :name
  end
  
  u = User.new
  u.name = 'john'
  u.name('john')
  </code></pre>
  
  <p>In order to fix that issue, I have decided to use alias_method. I know there are other ways to solve the problem, but I'm specifically looking if this problem could be solved using alias_method. Trying to learn.</p>
  
  <p>Following code will work</p>
  
  <pre><code>class User
    attr_accessor :name
    alias_method :foo, :name=
  end
  
  u = User.new
  u.foo('john')
  puts u.name
  </code></pre>
  
  <p>However this code will not work for obvious reason.</p>
  
  <pre><code>class User
    attr_accessor :name
    alias_method :name, :name=
  end
  
  u = User.new
  u.name('john')
  puts u.name
  </code></pre>
  
  <p>Anyone knows if this problem can be fixed with alias_method.</p>