我有一个带有Devise / omniauth的Rails应用程序,并且由于某些原因无法识别设计路径。当我使用例如" app_user_omniauth_authorize_path(:facebook)"我得到未定义的方法错误。所有其他路径都相同..
rake routes
返回:
dev_section POST /dev_section(.:format) custom_actions#dev_section
new_app_user_session GET /app_users/sign_in(.:format) devise/sessions#new
app_user_session POST /app_users/sign_in(.:format) devise/sessions#create
destroy_app_user_session DELETE /app_users/sign_out(.:format) devise/sessions#destroy
app_user_omniauth_authorize GET|POST /app_users/auth/:provider(.:format) app_users/omniauth_callbacks#passthru {:provider=>/facebook|twitter|google_oauth2/}
app_user_omniauth_callback GET|POST /app_users/auth/:action/callback(.:format) app_users/omniauth_callbacks#(?-mix:facebook|twitter|google_oauth2)
app_user_password POST /app_users/password(.:format) devise/passwords#create
new_app_user_password GET /app_users/password/new(.:format) devise/passwords#new
edit_app_user_password GET /app_users/password/edit(.:format) devise/passwords#edit
PUT /app_users/password(.:format) devise/passwords#update
cancel_app_user_registration GET /app_users/cancel(.:format) devise/registrations#cancel
app_user_registration POST /app_users(.:format) devise/registrations#create
new_app_user_registration GET /app_users/sign_up(.:format) devise/registrations#new
edit_app_user_registration GET /app_users/edit(.:format) devise/registrations#edit
PUT /app_users(.:format) devise/registrations#update
DELETE /app_users(.:format) devise/registrations#destroy
在routes.rb中我有:
devise_for :app_users, :controllers => {:omniauth_callbacks => "app_users/omniauth_callbacks" }
所有omniauth控制器都是根据Devise示例构建的。可能出现什么问题?
*编辑*
我意识到值得一提的是,我正在使用RefineryCMS ..
devise.rb看起来像这样:
Devise.setup do |config|
config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
ActiveSupport.on_load(:active_record) do
Devise.setup do
require 'devise/orm/active_record'
end
end
config.authentication_keys = [ :login ]
config.case_insensitive_keys = []
config.skip_session_storage = [:http_auth]
config.stretches = Rails.env.test? ? 1 : 10
config.password_length = 4..128
config.reset_password_within = 6.hours
config.sign_out_via = :delete
config.router_name = :refinery
end