我有以下控制器
class ActiveUsersController < ApplicationController
def edit
end
端
我的routes.rb是这样的:
map.resources :active_users
当我尝试使用网址http://localhost:3000/active_users/COo8e45RqQAHr6CqSCoI/edit访问控制器时出现以下错误:
NameError in Active usersController#edit
uninitialized constant ActiveUsersController
RAILS_ROOT: /Users/vintem/Documents/Projetos/Pessoal/bugfreela
Application Trace | Framework Trace | Full Trace
/Users/vintem/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:443:in `load_missing_constant'
/Users/vintem/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
/Users/vintem/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing'
/Users/vintem/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:361:in `constantize'
/Users/vintem/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in `each'
/Users/vintem/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in `constantize'
/Users/vintem/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/string/inflections.rb:162:in `constantize'
/Users/vintem/.gem/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:443:in `recognize'
/Users/vintem/.gem/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:436:in `call'
任何人都可以帮助我吗?
由于
答案 0 :(得分:0)
resources
指的是模型和假设的相关控制器,命名方式相似。你有ActiveUser
模特课吗?或者是其他什么,比如说User
? E.g:
map.resources users, :controller => "active_users"
查看API文档: http://api.rubyonrails.org/classes/ActionController/Resources.html
很难确切地告诉您提供的信息有什么问题。