Fix broken migrations caused by #290 #323

Merged
merged 2 commits into from Oct 23, 2012
View
@@ -7,3 +7,4 @@ coverage/*
doc/*
benchmarks/*
.specification
+.rvmrc
@@ -28,7 +28,10 @@ module Config
# See the various sub modules for the configuration they provide.
def acts_as_authentic(unsupported_options = nil, &block)
# Stop all configuration if the DB is not set up
- raise StandardError.new("You must establish a database connection before using acts_as_authentic") if !db_setup?
+ return unless table_exists?
+
+ # Raise an error if you've loaded the model without establishing a valid database connection.
+ raise StandardError.new("You must establish a database connection before using acts_as_authentic") unless connection.present?
raise ArgumentError.new("You are using the old v1.X.X configuration method for Authlogic. Instead of " +
"passing a hash of configuration options to acts_as_authentic, pass a block: acts_as_authentic { |c| c.my_option = my_value }") if !unsupported_options.nil?
@@ -14,5 +14,12 @@ def test_acts_as_authentic_with_old_config
User.acts_as_authentic({})
end
end
+
+ def test_acts_as_authentic_with_no_table
+ klass = Class.new(ActiveRecord::Base)
+ assert_nothing_raised do
+ klass.acts_as_authentic
+ end
+ end
end
end