Merge pull request #1159 from nishanthvijayan/changelog-improvements

Misc improvements to Revision History
This commit is contained in:
Stella Rouzi 2016-11-21 19:21:02 +02:00 committed by GitHub
commit 6c39d34322
8 changed files with 211 additions and 134 deletions

View file

@ -3,6 +3,8 @@ class EventSchedule < ActiveRecord::Base
belongs_to :event
belongs_to :room
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }
validates :schedule, presence: true
validates :event, presence: true
validates :room, presence: true
@ -28,4 +30,10 @@ class EventSchedule < ActiveRecord::Base
def intersecting_events
room.event_schedules.where(start_time: start_time, schedule: schedule).where.not(id: id)
end
private
def conference_id
schedule.program.conference_id
end
end

View file

@ -3,7 +3,7 @@ class Role < ActiveRecord::Base
has_many :users_roles
has_many :users, through: :users_roles
has_paper_trail on: [:update], only: [:name, :description], meta: { conference_id: :resource_id }
has_paper_trail on: [:create, :update], only: [:name, :description], meta: { conference_id: :resource_id }
before_destroy :cancel
scopify

View file

@ -2,4 +2,12 @@ class Schedule < ActiveRecord::Base
belongs_to :program
has_many :event_schedules, dependent: :destroy
has_many :events, through: :event_schedules
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }
private
def conference_id
program.conference_id
end
end