I know this is kinda basic, but who else could I ask besides you folks?

Is there a standard SQL way to indicate that the records in a database
should always be returned sorted by a particular column?

Is there a standard (or better) Rails way to indicate the same thing?

Is there a non-standard way to do this specific to Sqlite3, MySQL, etc... ?

Yes, I know I can do a:

parts = Part.find(:order => :number)

whenever I want to retrieve a list of parts from my db, but the spirit
of DRY doesn't seem to be appeased when I find myself writing this
_everywhere_ I fetch parts.

I suppose I could write a specific class method for my Part model, or
perhaps I could even override the default #find method, but I started
wondering if, perhaps, there was a standard SQL way, standard Rails
way, or nonstandard db-specific way, to indicate that I always want
records returned from my Parts table to be sorted by part number.

--wpd

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to