kommentare für gremium und calentry
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: calentries
|
||||
@@ -17,14 +18,13 @@ class Calentry < ActiveRecord::Base
|
||||
validates :start, :presence => true
|
||||
validates :typ, :presence => true
|
||||
before_save :get_public
|
||||
belongs_to :object, polymorphic: true
|
||||
belongs_to :object, polymorphic: true # Objekt zu dem der Calentry gehört (derzeit ein Newsartikel)
|
||||
|
||||
validate do |entry|
|
||||
validate do |entry|
|
||||
if entry.ende.nil?
|
||||
errors.add(:ende, "Es muss ein Endzeitpunkt vorhanden sein")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
resourcify
|
||||
def get_public
|
||||
@@ -38,7 +38,11 @@ class Calentry < ActiveRecord::Base
|
||||
start.to_date
|
||||
end
|
||||
def name
|
||||
summary
|
||||
unless self.object.nil?
|
||||
self.object.name
|
||||
else
|
||||
summary
|
||||
end
|
||||
end
|
||||
scope :public, -> { where(:public => :true) }
|
||||
scope :upcoming, -> { where("start >= ?" , Time.now).where("start <= ?", 8.days.from_now) }
|
||||
|
||||
Reference in New Issue
Block a user