Added the start of a new migration to use the Rate plugin
* Migration 9 will abort with a message if the Rate plugin isn't installed #1924
This commit is contained in:
1 parent
0f7c630f9c
commit
8a08e654e0
1 file changed
+21
@@ -0,0 +1,21 @@
|
|||||||
|
RateMigrationErrorMessage = "ERROR: The Rate plugin is not installed. Please install the Rate plugin or downgrade to version 0.1.0 of the Budget plugin."
|
||||||
|
|
||||||
|
begin
|
||||||
|
require_dependency 'rate'
|
||||||
|
rescue LoadError
|
||||||
|
raise Exception.new(RateMigrationErrorMessage)
|
||||||
|
end
|
||||||
|
|
||||||
|
class ConvertMemberRateToFullRates < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
self.check_that_rate_plugin_is_installed
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
self.check_that_rate_plugin_is_installed
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.check_that_rate_plugin_is_installed
|
||||||
|
raise Exception.new(RateMigrationErrorMessage) unless Object.const_defined?("Rate")
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in new issue
Block a user