проблема с неинициализированной константой - PullRequest
0 голосов
/ 17 апреля 2010

У меня есть следующий контроллер

class ActiveUsersController < ApplicationController

def edit
end

конец

А мой route.rb такой:

map.resources :active_users

Когда я пытаюсь получить доступ к контроллеру с помощью URL 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'

Кто-нибудь может мне помочь?

Спасибо

1 Ответ

0 голосов
/ 17 апреля 2010

resources относится к модели и предполагаемому коррелятному контроллеру, названному аналогично. У вас есть ActiveUser модель класса? Или это что-то еще, скажем User? E.g.:

map.resources users, :controller => "active_users"

Ознакомьтесь с документацией по API: http://api.rubyonrails.org/classes/ActionController/Resources.html

Трудно сказать точно, что не так с информацией, которую вы предоставили.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...