AutoCommit Don Aug 27 14:03:04 CEST 2015

This commit is contained in:
Andreas Stephanides
2015-08-27 14:03:04 +02:00
parent 1047851b47
commit 370c439c29

View File

@@ -21,7 +21,7 @@ class Calentry < ActiveRecord::Base
validates :typ, :presence => true validates :typ, :presence => true
before_save :get_public before_save :get_public
belongs_to :object, polymorphic: true, touch: true # Objekt zu dem der Calentry gehört (derzeit ein Newsartikel) belongs_to :object, polymorphic: true, touch: true # Objekt zu dem der Calentry gehört (derzeit ein Newsartikel)
scope :of_month,(d) -> {where("start >= ? AND start <= ?", d.beginning_of_month, d.end_of_month)}
scope :upcoming, ->{ where("start >= ?", Time.now).order(:start)} scope :upcoming, ->{ where("start >= ?", Time.now).order(:start)}
scope :recent,-> { where("start <= ?", Time.now).order(:start).reverse_order} scope :recent,-> { where("start <= ?", Time.now).order(:start).reverse_order}
validate do |entry| validate do |entry|