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