Rene Paulokat wrote:
> On Thu, 5 Feb 2009 22:41:43 +0100
> Rene Paulokat <[email protected]> wrote:
> 
> 
> (...)
>> d.h. aber dass du zum zeitpunkt des speicherns _immer_ auch ein valides
>> datum brauchst.
>> 
>> sie dir mal die hooks an fuer validate: die reihenfolge ist: validate
>> (generell bei jedem speichern oder anlegen) , validate_on_save (nur
> (...)
> 
> ich meinte natuerlich validate_on_update....
> 
> tzk
> rene

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!
-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/listinfo/rubyonrails-ug

Antwort per Email an