Neuigkeiten Link

Querverweise für Neuigkeiten
This commit is contained in:
Andreas Stephanides
2014-03-29 11:30:46 +01:00
parent 1d2d3e791b
commit a8401391a6
22 changed files with 199 additions and 55 deletions

View File

@@ -28,8 +28,11 @@ class Neuigkeit < ActiveRecord::Base
scope :unpublished, -> {where("datum >= ? OR datum IS NULL", Date.today)}
scope :public, ->{includes(:rubrik).where("rubriken.public"=>:true)}
scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")}
LINKTYPES=["Thema", "Gallery", "Lva"]
accepts_nested_attributes_for :calentries, :allow_destroy=>true , :reject_if=> lambda{|a| a[:start].blank?}
before_validation :sanitize
has_many :nlinks
def datum_nilsave
self.datum.nil? ? Time.now + 42.years : self.datum
end