This is Greg Piatigorski's Typepad Profile.
Join Typepad and start following Greg Piatigorski's activity
Join Now!
Already a member? Sign In
Greg Piatigorski
Recent Activity
Dave, I am a long time DBA, going back to early '80s, working with mainframe to mid to personal db engines, and perhaps my take on the subject is so different here. .first, to me, implies ANY record, at least to someone who has been a DBA for so long. SQL is a pretty powerful and flexible language and as with any other language out there one has to code for specific results if one wants specific results. Rails is a binder, not an SQL "cop", IMHO. Should Rails be changed to also issue DISTINCT clause, or GROUP BY on every data request when this ability is already built into SQL from the start, as is ORDER BY? I am not sure what the issue is when .first means ANY record from a result set. Absolutely so. There is a reason SQL has WHERE clause, ORDER BY, DISTINCT, GROUP BY and all other tricks and abilities built in. .first with WHERE clause should do the job just fine?
Is assumption here to have Rails actually do Top n query? If not, I am not sure this is a bug. There is a difference between .first and Top 1.
Greg Piatigorski is now following The Typepad Team
Mar 23, 2012