Ruby error with non-required arguments on method
<p>This is on Ruby 2.1.8.</p>

<p>I have the following method:</p>

<pre><code>def self.notify(methods=[], user, message_key, notifiable_id=nil, notifiable_type=nil)
  # Do some stuff
end
</code></pre>

<p>When I try to use this method and pass in valid values, I get the following error:</p>

<pre><code>SyntaxError:
: syntax error, unexpected '=', expecting ')'
...er, message_key, notifiable_id=nil, notifiable_type=nil)
...                               ^
: Can't assign to nil
...message_key, notifiable_id=nil, notifiable_type=nil)
...   
</code></pre>

<p>For the life of me I cannot figure out why. If I remove the <code>=nil</code> from <code>notifiable_id</code> and <code>notifiable_type</code> in the method arguments, everything works fine.</p>

<p>And FWIW assigning <code>methods</code> to an empty array is not the issue. If I don't assign that or assign it to <code>nil</code> I get the same issue.</p>

<p>Any thoughts appreciated.</p>