rails/rails — pull request #5639 by jonleighton (2012-03-28 16:55:21+00:00)
Title: API change to Relation#first and Relation#last

Hi guys,

I want to deprecate dynamic finders etc:

* They are duplicating functionality we already have from `ActiveRecord::Relation`
* They are inflexible; changing the columns dynamically requires using `send`
* API bloat

The problem:

``` ruby
Post.find_by_title('lol')
```

is nicer than these:

``` ruby
Post.where(title: 'lol').first
Post.first(conditions: { title: 'lol' })
```

This would not be a problem if we could do this:

``` ruby
Post.first(title: 'lol')
```

But currently `#first` and `#last` take a hash of old-style finder conditions.

I want to:

* Deprecate `#first` and `#last` taking old-style finder conditions
* Enable `#first` and `#last` to take normal conditions, just like you'd pass to `#where`
* Deprecate dynamic finders

This code is *unfinished* but contains a proof-of-concept for `#first` to show that this is possible and to demonstrate my proposed solution.