Skip to content

Commit

Permalink
Add resource relation hack
Browse files Browse the repository at this point in the history
  • Loading branch information
bdunne committed Jun 14, 2018
1 parent b87bc5e commit 4c3a53f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/models/miq_schedule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ class MiqSchedule < ApplicationRecord
default_value_for :enabled, true
default_value_for(:zone_id) { MiqServer.my_server.zone_id }

def resource
# HACK: this should be a real relation, but for now it's using a reserve_attribute for backport reasons
return unless resource_id
towhat.safe_constantize.find_by(:id => resource_id)
end

def set_start_time_and_prod_default
run_at # Internally this will correct :start_time to UTC
self.prod_default = "system" if SYSTEM_SCHEDULE_CLASSES.include?(towhat.to_s)
Expand Down

0 comments on commit 4c3a53f

Please sign in to comment.