warum nicht

if deliverdate_changed? && deliverdate <= Date.today

?
Am 06.02.2009 um 10:30 schrieb Thomas R. Koll:


Am 05.02.2009 um 22:34 schrieb Adam Meyer:

class Order < ActiveRecord::Base
belongs_to :user
has_many :products
belongs_to :raddress

 def validate_on_create
  if deliverdate <= Date.today
   errors.add(:deliverdate, "Datum muss in der Zukunft liegen.")
  end
 end
end


Das Problem ist aber, dass ich immer noch frühere Dati speichern kann.

Ungefähr heute wirst du feststellen dass du den Bestellstatus der gestrigen
Bestellung nicht mehr ändern kannst. Blöde Sache.

def validate_delivery_date
 if created_at and delivery_date < created_at
   errors_add(:delivery_date, "must be in The Future")
 end
end


ciao, tom

--
Thomas R. "TomK32" Koll || http://tomk32.de || http://ananasblau.com
just a geek trying to change the world
Skype: TomK32 || Mail: [email protected]
http://flickr.com/people/tomk32

_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/listinfo/rubyonrails-ug

---
Siebert WD
Michael Siebert
Trappenweg 6, 15749 Mittenwalde, Deutschland

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/listinfo/rubyonrails-ug

Antwort per Email an