Kalender überarbeitet Issue 91

This commit is contained in:
Andreas Stephanides
2013-11-28 10:14:36 +01:00
parent 6fa208dcbe
commit 0a507502ba
16 changed files with 72 additions and 19 deletions

View File

@@ -16,13 +16,22 @@ class Rubrik < ActiveRecord::Base
has_many :calentries, :through => :neuigkeiten, :as=>:object
resourcify
has_one :calendar
validates :calender , :presence=>true
validates :calendar , :presence=>true
before_validation :sanitize
def moderator
u=User.with_role(:newsmoderator).first
if !u.nil?
u.id
end
end
def sanitize
if self.calendar.nil?
self.calendar=Calendar.new
end
self.calendar.name=self.name
self.calendar.public=self.public
self.calendar.save
end
end