ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ruby-rails
ruby-rails
[Rails] Re: Date Types in Unit Tests
by Michael Schuerig other posts by this author
Aug 30 2005 11:04PM messages near this date
[Rails] Date Types in Unit Tests | Re: [Rails] Date Types in Unit Tests
[CC'd because list messages appear to have an enormous delay currently.]

On Monday 29 August 2005 05:55, Steve Ross wrote:
>  @sale = Sale.new
>  ...
>  @sale.sale_date = 1.week.ago
>  assert @sale.save
> 
>  And get an error that I can't compare a Date and Time. Specifically,
> 
>  ArgumentError: comparison of Date with Time failed

Try

@sale.sale_date = 1.week.ago.to_date

Michael

-- 
Michael Schuerig                  There is no matrix,
mailto:michael@[...].de        only reality.
http://www.schuerig.de/michael/   --Lawrence Fishburn
_______________________________________________
Rails mailing list
Rails@[...].org
http://lists.rubyonrails.org/mailman/listinfo/rails
Thread:
Steve Ross
Michael Schuerig
Dee Zsombor

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved