我被计算出来了,但没有结果。我有一个名为User的模型,还有一个拥有STI粉丝和艺术家的模型,如下所示:
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable, :confirmable, :lockable,
:recoverable, :rememberable, :trackable, :validatable, **:omniauthable**
end和我的其他模型
Class Artist < User end
Class Fan < User end我的路线
devise_for :users
devise_for :artists
devise_for :fans我有一个问题,当我尝试运行我的服务器或其他任何东西时,我得到了这个错误
Wrong OmniAuth configuration. If you are getting this exception, it means that either:
1) You are manually setting OmniAuth.config.path_prefix and it doesn't match the Devise one
2) You are setting :omniauthable in more than one model
3) You changed your Devise routes/OmniAuth setting and haven't restarted your server我的应用程序很高级,我不想回去重构它,任何帮助都将不胜感激
发布于 2012-11-28 03:41:57
答案可以在here找到。
Devise会混淆,因为您要为三个不同的模型调用devise_for,而其中一个使用的是omniauthable模块。
以下任一项:
删除除:users.
omniauthable模块,创建您自己的omniauth路由,并通过将您的omniauth配置移到一个新文件中来停止使用devise的中间件。因此,在devise.rb中没有这样的代码:配置do | Devise.setup | config.omniauth :twitter,ENV'TWITTER_KEY',ENV‘twitter_Devise.setup’结束
现在,您的新文件omniauth.rb中包含以下内容:
Rails.application.config.middleware.use OmniAuth::Builder do provider :twitter,ENV'TWITTER_KEY',ENV'TWITTER_SECRET‘结束
:The Railscast on Simple OmniAuth应该能帮你设置好。
https://stackoverflow.com/questions/13567113
复制相似问题