studium_edit_lvas added

This commit is contained in:
Andreas Stephanides
2014-04-12 18:03:39 +02:00
parent 7fff32bab1
commit f96c3dee9a
9 changed files with 89 additions and 48 deletions

View File

@@ -23,6 +23,7 @@ class Neuigkeit < ActiveRecord::Base
has_many :calentries, as: :object
mount_uploader :picture, PictureUploader
scope :published, -> {where("datum <= ? AND datum IS NOT NULL", Time.now.to_date).order(:datum).reverse_order}
scope :recent, -> { published.limit(15)}
scope :unpublished, -> {where("datum >= ? OR datum IS NULL", Date.today)}
@@ -32,7 +33,7 @@ class Neuigkeit < ActiveRecord::Base
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