Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ GEM
awesome_nested_set (3.8.0)
activerecord (>= 4.0.0, < 8.1)
base64 (0.3.0)
bcrypt (3.1.20)
bcrypt (3.1.22)
benchmark (0.4.1)
bigdecimal (3.2.2)
bindex (0.8.1)
Expand Down
9 changes: 9 additions & 0 deletions app/models/track.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Track < ApplicationRecord
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }

before_create :generate_guid
after_update :sync_room_to_event_schedules, if: :saved_change_to_room_id?
validates :name, presence: true
validates :color, format: /\A#[0-9A-F]{6}\z/
validates :short_name,
Expand Down Expand Up @@ -174,6 +175,14 @@ def update_state(transition)

private

def sync_room_to_event_schedules
return unless room_id

events.joins(:event_schedules).find_each do |event|
event.event_schedules.update_all(room_id: room_id)
end
end

def generate_guid
guid = SecureRandom.urlsafe_base64
# begin
Expand Down