sanitazion earlier

This commit is contained in:
Andreas Stephanides
2013-11-13 15:52:54 +01:00
parent e62f5a2600
commit 552e5cb38e

View File

@@ -27,7 +27,7 @@ class Neuigkeit < ActiveRecord::Base
scope :unpublished, -> {where("datum >= ? OR datum IS NULL", Date.today)} scope :unpublished, -> {where("datum >= ? OR datum IS NULL", Date.today)}
scope :public, ->{includes(:rubrik).where("rubriken.public"=>:true)} scope :public, ->{includes(:rubrik).where("rubriken.public"=>:true)}
accepts_nested_attributes_for :calentries, :allow_destroy=>true , :reject_if=> lambda{|a| a[:start].blank?} accepts_nested_attributes_for :calentries, :allow_destroy=>true , :reject_if=> lambda{|a| a[:start].blank?}
before_save :sanitize before_validation :sanitize
def datum_nilsave def datum_nilsave
self.datum.nil? ? Time.now + 42.years : self.datum self.datum.nil? ? Time.now + 42.years : self.datum
end end