Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Fix broken migrations caused by #290 #323

merged 2 commits into from

8 participants


Hi Ben,

I've fixed #318 and #322 which were caused by #290 raising an exception on !db_setup? which meant migrations were never run. I've partially restored your original code to check whether the table exists.

It would be good to get this in as it's hindering people setting up new projects with Authlogic.


james2m added some commits

Thanks for fixing this James. It would be great to get this merged as soon as possible, we had to jump though some hoops to work around it.


Cloning the fixed branch does not work. Why can't you merge the fix into master. It seems like it's taking an act of God to get this fixed.


Can you tell me what the typo is and I'll fix it.





@binarylogic binarylogic merged commit beaabc5 into binarylogic:master

This fix has a small caveat. If you have User.create in your seeder (db/seeds.rb), this won't be doable anymore:

$ rake db:drop
$ rake db:setup

It gets you this error:

undefined method 'password=' for #<User:....>

This is because acts_as_authentic has return unless table_exists? which stops it from creating the password= method.


...actually, forget that: that bug has existed since 2 years ago.#88


@rstacruz That explains something I've never got round to investigating. It's only a problem if you run your seeds in the same session as your migrations right? e.g.

$ rake db:migrate db:seed

@james2m Yes, which Rails does by default with:

$ rake db:setup

...which is simply an alias for db:create db:schema:load db:seed.

@james2m james2m deleted the james2m:fix-migrations branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 11, 2012
  1. @james2m

    Ignored .rvmrc files.

    james2m authored
  2. @james2m

    Fixes #318 and fixes #322 broken migrations caused by #290.

    james2m authored
    Signed-off-by: James McCarthy <>
This page is out of date. Refresh to see the latest.
1  .gitignore
@@ -7,3 +7,4 @@ coverage/*
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"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"You must establish a database connection before using acts_as_authentic") unless connection.present?
raise"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?
7 test/acts_as_authentic_test/base_test.rb
@@ -14,5 +14,12 @@ def test_acts_as_authentic_with_old_config
+ def test_acts_as_authentic_with_no_table
+ klass =
+ assert_nothing_raised do
+ klass.acts_as_authentic
+ end
+ end
Something went wrong with that request. Please try again.