路由错误 - 未初始化的常量 [英] Routing error - uninitialized constant

查看:47
本文介绍了路由错误 - 未初始化的常量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在 Rails 3.2.12 中修复这个问题,也许我遗漏了一些东西.

I could not fix this in Rails 3.2.12, maybe I am missing something.

config/routes.rb

get "home/index"
root :to => "home#index"
devise_for :users, :only => :omniauth_callbacks
match 'users/auth/:provider/callback' => 'authentications#create'
match '/auth/:provider/signout' => 'authentications#signout'

app/controllers/authentication_controller.rb

class AuthenticationsController < ApplicationController
  ...
end

app/models/authentication.rb

class Authentication < ActiveRecord::Base
  ...
end

我认为它应该适用于我目前的知识,但我想念一些东西.

I think it should work with my current knowledge, but there is something that I miss.

我的问题是请告诉我出了什么问题.

My kind question would be to tell what is wrong, please.

路由错误

未初始化的常量AuthenticationsController

这是一条显示在 http://localhost:3000/auth/facebook/signout

推荐答案

Rails 要求文件名与类名匹配.因此,您应该将 app/controllers/authentication_controller.rb 重命名为 app/controllers/authentications_controller.rb.

Rails requires the file name to match the class name. Therefore you should rename app/controllers/authentication_controller.rb to app/controllers/authentications_controller.rb.

这篇关于路由错误 - 未初始化的常量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆