rails/rails — pull request #16339 by rwz (2014-07-29 17:58:00+00:00)
Title: Add implicit receiver support to `Object#with_options`

I've noticed that 99% of the cases I use `Object#with_options` to define a bunch of associations or validations in my models. The code could be much cleaner if we wouldn't have to pass explicit receiver to `with_options` block all the time, especially if it's gonna be the only receiver.

So, this pull request makes it possible. It's also fully backwards compatible.

Before:

```ruby
class Account < ActiveRecord::Base
with_options dependent: :destroy do |assoc|
assoc.has_many :customers
assoc.has_many :products
assoc.has_many :invoices
assoc.has_many :expenses
end
end
```

After:

```ruby
class Account < ActiveRecord::Base
with_options dependent: :destroy do
has_many :customers
has_many :products
has_many :invoices
has_many :expenses
end
end
```