Shandy Nantz wrote:> I have these entries in the database that have a date field attached to
> them and looks something like:
>
> March 1, 2008
> March 9, 2008
> March 10, 2008
>
> When I do a find and get in oder of ASC it arranges the list as follows:
>
> March 1, 2008
> March 10, 2008
> March 9, 2008
>
> Is there a way to get it to display the list in the correct way?
>
> March 1, 2008
> March 9, 2008,
> March 10, 2008
>
It sounds to me like you''re storing those as a formatted string, not as
a datetime object. If you set the table column type to :datetime and
store the actual date, rather than a string, sorting with ASC should
work. Then, format the date however you like in the view. Use a helper
for consistent formatting if displaying the date in multiple places.
--
http://www.5valleys.com/
http://www.workingwithrails.com/person/8078
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---