Ruby on Rails Thursday, October 16, 2014

On 16 October 2014 12:49, Jin Xie <jinfengxie1986@gmail.com> wrote:
> at this
> method(https://github.com/rails/rails/blob/08754f12e65a9ec79633a605e986d0f1ffa4b251/activerecord/lib/active_record/schema_migration.rb#L24)
>
> limit is default to `nil` which mean it is optional argument, and few lines
> down `version_options` only adds limit when the limit is passed from the
> argument.
>
> and in this
> method(https://github.com/rails/rails/blob/08754f12e65a9ec79633a605e986d0f1ffa4b251/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb#L241)
> pass on the options to `new_column_definition `, and this
> `new_column_definition`
> method(https://github.com/rails/rails/blob/08754f12e65a9ec79633a605e986d0f1ffa4b251/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb#L295)
> will try to `fetch(:limit)` which will raise exception.
>
> Am wondering had I missing something ?

If fetch does not find the key then it runs the block.
http://ruby-doc.org/core-2.1.3/Hash.html#method-i-fetch

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuS-utvJN3B4HN3X%3D1bi4%2BRd73_q2Joc4EVxSauaPWdkw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment