diverse fixed

This commit is contained in:
Andreas Stephanides
2014-03-23 21:02:47 +01:00
parent 8f4528f994
commit c235619e31
10 changed files with 46 additions and 32 deletions

View File

@@ -21,6 +21,7 @@ class Calentry < ActiveRecord::Base
validates :typ, :presence => true
before_save :get_public
belongs_to :object, polymorphic: true # Objekt zu dem der Calentry gehört (derzeit ein Newsartikel)
scope :upcoming, ->{ where("start >= ?", Time.now).order(:start)}
scope :recent,-> { where("start <= ?", Time.now).order(:start).reverse_order}
validate do |entry|
@@ -31,8 +32,8 @@ class Calentry < ActiveRecord::Base
resourcify
def get_public
self.public = (self.try(:object).nil?)? (self.calendar.try(:public)) : object.try(:public)
true
self.public = (self.try(:object).nil?)? (self.calendar.try(:public)) : object.try(:public)
true
end
def start_time
start