This project is archived and is in readonly mode.
Add find_last_by dynamic finder
Reported by Emilio Tagua | August 5th, 2008 @ 11:02 PM | in 2.x
In order to be consistent, an also helpful, dynamic finders should allow to find the last record with the same options as find_by and find_all_by are defined.
Following the principle of least surprise, "last" should adhere to all "first" semantics and conventions.
Comments and changes to this ticket
-
Clemens Kofler August 8th, 2008 @ 03:36 PM
Shouldn't findby be renamed to findfirst_by then? I don't know, perhaps it's just my general dislike of dynamic finders, but I'm kinda -1 on this. Sure, it doesn't do any damage but I don't think it adds real value either.
-
Emilio Tagua August 8th, 2008 @ 04:00 PM
Clemens,
It's not about damage, it's about consistency.
I don't think find_by should be renamed necessarily, i think that it is not bad at all to have a default, as find first is at the moment.
There are 3 finders: first, all and last. And whether you use the 3 of them or not, or if you like using dynamic finders or not, the framework should treat equally and provide this shortcut for the 3 of them.
-
Clemens Kofler August 10th, 2008 @ 01:21 PM
I don't see the point in find(:last) either. After all, it doesn't make a difference if I say find(:first, :order => "something DESC") or find(:last, :order => "something ASC"). I think, just by itself, the naming of :first is the "weird" thing - it should rather be :single or :one.
-
Emilio Tagua September 1st, 2008 @ 05:37 PM
- no changes were found...
-
DHH September 10th, 2008 @ 05:46 AM
- State changed from new to committed
-
Ryan Bigg October 11th, 2010 @ 10:55 AM
- Tag cleared.
- Importance changed from to Low
Automatic cleanup of spam.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>