dependent and calendar

This commit is contained in:
Andreas Stephanides
2015-06-11 15:47:26 +02:00
parent 2f1a63931c
commit 12a82f519c
4 changed files with 42 additions and 36 deletions

View File

@@ -7,7 +7,7 @@ class Meeting < ActiveRecord::Base
belongs_to :neuigkeit, touch: true
has_one :protocol, :class_name=>'Document', :conditions=>{:typ=>10}, :as=>:parent
has_one :agenda , :as=>:parent,:conditions=>{:typ=>11}, :class_name=>'Document'
has_one :calentry, as: :object
has_one :calentry, as: :object, :dependent=> :destroy
has_one :calendar, :through=>:meetingtyp
has_one :rubrik, :through=>:meetingtyp
scope :upcomming, includes(:calentry).where("calentries.start>?",1.hour.ago)