Exception: ActiveRecord::EnvironmentMismatchError

Inherits:
ActiveRecordError show all
Defined in:
lib/active_record/migration.rb

Instance Method Summary collapse

Constructor Details

#initialize(current: nil, stored: nil) ⇒ EnvironmentMismatchError

Returns a new instance of EnvironmentMismatchError.



179
180
181
182
183
184
185
186
187
188
189
# File 'lib/active_record/migration.rb', line 179

def initialize(current: nil, stored: nil)
  msg = +"You are attempting to modify a database that was last run in `#{ stored }` environment.\n"
  msg << "You are running in `#{ current }` environment. "
  msg << "If you are sure you want to continue, first set the environment using:\n\n"
  msg << "        rails db:environment:set"
  if defined?(Rails.env)
    super("#{msg} RAILS_ENV=#{::Rails.env}\n\n")
  else
    super("#{msg}\n\n")
  end
end