Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken migrations caused by #290 #323

Merged
merged 2 commits into from Oct 23, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -7,3 +7,4 @@ coverage/*
doc/* doc/*
benchmarks/* benchmarks/*
.specification .specification
.rvmrc
5 changes: 4 additions & 1 deletion lib/authlogic/acts_as_authentic/base.rb
Expand Up @@ -28,7 +28,10 @@ module Config
# See the various sub modules for the configuration they provide. # See the various sub modules for the configuration they provide.
def acts_as_authentic(unsupported_options = nil, &block) def acts_as_authentic(unsupported_options = nil, &block)
# Stop all configuration if the DB is not set up # 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 " + 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? "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?
Expand Down
7 changes: 7 additions & 0 deletions test/acts_as_authentic_test/base_test.rb
Expand Up @@ -14,5 +14,12 @@ def test_acts_as_authentic_with_old_config
User.acts_as_authentic({}) User.acts_as_authentic({})
end end
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
end end