Re: [Rails-core] ActiveRecord first vs last

2013-02-23 Thread Borna Novak
Just a thought, how does this work with legacy tables that have no PK? What makes them possible now is that you can filter down with 'where' onto a single record and get .first out without triggering a fetch through ID. Perhaps implement an any finder method with same function as the old first

Re: [Rails-core] ActiveRecord first vs last

2013-02-23 Thread Xavier Noria
On Sat, Feb 23, 2013 at 8:44 PM, Borna Novak dosadni...@gmail.com wrote: how does this work with legacy tables that have no PK? What makes them possible now is that you can filter down with 'where' onto a single record and get .first out without triggering a fetch through ID. Perhaps implement

[Rails-core] ActiveRecord first vs last

2013-02-22 Thread Panayotis Matsinopoulos
Hi, According to http://guides.rubyonrails.org/active_record_querying.html, first does not use ORDER BY ID to bring the first record. Whereas last does. I find this inconsistent. I can also say that this is buggy on MySQL. limit 1 does not always bring the record with the minimum id. I can

Re: [Rails-core] ActiveRecord first vs last

2013-02-22 Thread Rafael Mendonça França
It is already done at master branch. https://github.com/rails/rails/commit/66b9e4c857b5987a52f0442ae382ee18dc3dd30a Rafael Mendonça França http://twitter.com/rafaelfranca https://github.com/rafaelfranca On Fri, Feb 22, 2013 at 1:26 PM, Panayotis Matsinopoulos panayo...@matsinopoulos.gr wrote:

Re: [Rails-core] ActiveRecord first vs last

2013-02-22 Thread Luís Ferreira
This is already fixed on Rails 4.0 On Feb 22, 2013, at 4:26 PM, Panayotis Matsinopoulos wrote: Hi, According to http://guides.rubyonrails.org/active_record_querying.html, first does not use ORDER BY ID to bring the first record. Whereas last does. I find this inconsistent. I can also