Hmmmm. Ich meinte natürlich "Hi Adam" *too late* ;)
Am 05.02.2009 um 22:41 schrieb Benjamin Behr | mindmatters <[email protected]
>:
Hi Rene,
dann mach aus dem <= einfach ein >. Also statt "deliverdate <=
Date.today" ein "deliverdate > Date.today".
Schöne Grüße,
Benny
Am 05.02.2009 um 22:34 schrieb Adam Meyer <[email protected]>:
Rene Paulokat wrote:
On Thu, 5 Feb 2009 21:11:38 +0100
Adam Meyer <[email protected]> wrote:
nichts finde.
bspw. so:
class Event < ActiveRecord::Base
attr_accessor :start_date
def validate_on_create
if @start_date == nil || @start_date <= Date.today
errors.add(:start_date, "muss in der zukunft liegen.")
end
end
end
oder du erweiterst Validation um sowas wie
validates_date_greater_than
...
gruesse
rene
Hi Rene
Also ich habe jetzt folgenden code in meinem Order model in dem
deliverdate das besagte datum enthält
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 k
ann.
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/listinfo/rubyonrails-ug
_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/listinfo/rubyonrails-ug
_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/listinfo/rubyonrails-ug