On Thu, 5 Feb 2009 22:52:13 +0100 Adam Meyer <[email protected]> wrote:
> Also im Moment habe ich > > class Order < ActiveRecord::Base > belongs_to :user > has_many :products > belongs_to :raddress > > def validate > if deliverdate <= Date.today > errors.add(:deliverdate, "Datum muss in der Zukunft liegen.") > end > end > end > > Und kann immer noch alles mögliche speichern! d.h. auch datum von vorgestern? oder nur datum von heute? wenn nur von heute würde ich von datentyp 'datetime', 'time', oder 'timestamp' auf typ 'date' umsteigen sofern die uhrzeit egal ist :) denn: r...@tank:~$ irb irb(main):001:0> d = Date.today => #<Date: 4909735/2,0,2299161> irb(main):002:0> t = DateTime.now => #<DateTime: 4418763148664779/1800000000,1/24,2299161> irb(main):003:0> d < t => true irb(main):004:0> t < d => false > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rubyonrails-ug mailing list > [email protected] > http://mailman.headflash.com/listinfo/rubyonrails-ug -- take care not to get sucked into /dev/null gpg --recv-keys 0F8DDFBB _______________________________________________ rubyonrails-ug mailing list [email protected] http://mailman.headflash.com/listinfo/rubyonrails-ug
