Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #323 from james2m/fix-migrations

Fix broken migrations caused by #290
  • Loading branch information...
commit beaabc5465fcbde2ea761bd51ffd0bf261fec679 2 parents 40c0e16 + d1fdc90
@binarylogic authored
View
1  .gitignore
@@ -7,3 +7,4 @@ coverage/*
doc/*
benchmarks/*
.specification
+.rvmrc
View
5 lib/authlogic/acts_as_authentic/base.rb
@@ -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?
View
7 test/acts_as_authentic_test/base_test.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.