VvDPzZ
VvDPzZ

Reputation: 3095

Devise with OpenID in Rails3 beta4 but raise [undefined method `apply_schema'] error

I have use devise_openid_authenticatable to support OpenID with devise in rails3 beta4. But when I run rake db:migrate, it occurs [undefined method `apply_schema'] error.like this:

==  DeviseCreateUsers: migrating ==============================================
-- create_table(:users)
rake aborted!
An error has occurred, all later migrations canceled:

undefined method `apply_schema' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x1036ffb40>

Here is my migration file:

class DeviseCreateUsers  false
      t.openid_authenticatable
      t.recoverable
      t.rememberable
      t.trackable

      # t.confirmable
      # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
      # t.token_authenticatable

      t.timestamps
    end

    add_index :users, :identity_url, :unique => true
    # add_index :users, :email,                :unique => true
    # add_index :users, :reset_password_token, :unique => true
    # add_index :users, :confirmation_token,   :unique => true
    # add_index :users, :unlock_token,         :unique => true
  end

  def self.down
    drop_table :users
  end
end

And config.middleware.use Rack::OpenID in config/application.rb

Does anyone can give me a hand? Thank you!

Upvotes: 1

Views: 1098

Answers (2)

Nat Budin
Nat Budin

Reputation: 291

I'm the author of devise_openid_authenticatable. This issue was caused by a change in API in Devise 1.1.0 stable. I've added code to check for this and choose the appropriate API to use. The fix is released in the new devise_openid_authenticatable 1.0.0.alpha3.

Sorry about the trouble!

Upvotes: 8

VvDPzZ
VvDPzZ

Reputation: 3095

I think I have fixed this problem.

First,type $ bundle show devise_openid_authenticatable to see where the bundled gem is installed. e.g. /Users/YOURNAME/.bundle/ruby/1.8/gems/devise_openid_authenticatable-1.0.0.alpha2 cd in this directory and modify /lib/devise_openid_authenticatable/schema.rb from apply_schema :identity_url, String to apply_devise_schema :identity_url, String

That's OK!

Upvotes: 2

Related Questions