Skip to content

Commit

Permalink
Use an anonymous class for querying the miq_regions table
Browse files Browse the repository at this point in the history
This de-couples us from the model definition during migrations
  • Loading branch information
carbonin committed Sep 26, 2018
1 parent d558dd5 commit 313d4ad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/extensions/ar_migration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class HelperARClass < ActiveRecord::Base; end
attr_reader :region, :subscription, :version

def initialize(subscription, version)
@region = MiqRegion.find_by(:region => subscription.provider_region)
region_class = Class.new(ApplicationRecord) { self.table_name = "miq_regions" }
@region = region_class.find_by(:region => subscription.provider_region)
@subscription = subscription
@version = version
end
Expand Down

0 comments on commit 313d4ad

Please sign in to comment.