【问题标题】:Devise with OpenID in Rails3 beta4 but raise [undefined method `apply_schema'] error在 Rails3 beta4 中使用 OpenID 进行设计,但引发 [未定义方法 `apply_schema'] 错误
【发布时间】:2011-03-12 07:42:21
【问题描述】:

我在 rails3 beta4 中使用 devise_openid_authenticable 来支持 OpenID。 但是当我运行 rake db:migrate 时,会发生 [undefined method `apply_schema'] 错误。像这样:

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

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

这是我的迁移文件:

类 DeviseCreateUsers 假 t.openid_authenticable t.recoverable t.rememberable t.trackable # t.confirmable # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both # t.token_authenticable t.timestamps 结尾 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 结尾 def self.down drop_table :用户 结尾 结尾

还有config.middleware.use Rack::OpenID 在config/application.rb 中

有人可以帮帮我吗?谢谢!

【问题讨论】:

  • 是不是复制粘贴错了?第一行看起来像你做的那样。即:class DeviseCreateUsers false
  • 不,我的粘贴正确。它不会创建用户表。感谢您的回复。

标签: ruby-on-rails openid devise


【解决方案1】:

我想我已经解决了这个问题。

首先,输入 $ bundle show devise_openid_authenticatable 以查看捆绑 gem 的安装位置。 例如/Users/YOURNAME/.bundle/ruby/1.8/gems/devise_openid_authenticatable-1.0.0.alpha2 cd 在这个目录下并修改 /lib/devise_openid_authenticable/schema.rb 从apply_schema :identity_url, Stringapply_devise_schema :identity_url, String

没关系!

【讨论】:

    【解决方案2】:

    我是 devise_openid_authenticable 的作者。此问题是由 Devise 1.1.0 稳定版中的 API 更改引起的。我添加了代码来检查这一点并选择要使用的适当 API。该修复程序已在新的 devise_openid_authenticable 1.0.0.alpha3 中发布。

    抱歉给您添麻烦了!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-19
      • 1970-01-01
      • 2012-04-17
      • 1970-01-01
      • 2015-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多