Refer to Rails.env only when Rails is defined

This commit is contained in:
Akira Matsuda 2013-11-11 18:39:43 +09:00
parent 5b1221347d
commit 524d4a35d2

@ -32,7 +32,11 @@ def initialize(name)
class PendingMigrationError < ActiveRecordError#:nodoc:
def initialize
super("Migrations are pending; run 'bin/rake db:migrate RAILS_ENV=#{::Rails.env}' to resolve this issue.")
if defined?(Rails)
super("Migrations are pending; run 'bin/rake db:migrate RAILS_ENV=#{::Rails.env}' to resolve this issue.")
else
super("Migrations are pending; run 'bin/rake db:migrate' to resolve this issue.")
end
end
end