我正在处理admin命名空间,移动一些像用户这样的东西,将资源发布到管理部分。
在config / routes.rb中的我有:
namespace :admin do
root :to => 'pages#home'
#match "/" => "pages#home", :as => "index", :via => :get
resources :users, :posts
end
在app / controllers / admin / pages_controller.rb中我有:
class Admin::PagesController < Admin::ApplicationController
def home
@title = 'Home'
end
end
以下是错误:(完整的错误记录:http://pastebin.com/bwF1bBHz)
>> Listening on 0.0.0.0:3000, CTRL+C to stop
2013-06-20 15:50:04.488 [INFO ] (pid:28961)
2013-06-20 15:50:04.492 [INFO ] (pid:28961)
2013-06-20 15:50:04.496 [INFO ] Started GET "/admin" for 127.0.0.1 at 2013-06-20 15:50:04 -0500 (pid:28961)
2013-06-20 15:50:05.149 [INFO ] Processing by Admin::PagesController#home as HTML (pid:28961)
2013-06-20 15:50:05.166 [DEBUG] User Load (2.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1 (pid:28961)
2013-06-20 15:50:05.534 [ERROR] uninitialized constant Page
/usr/local/rvm/gems/ruby-2.0.0-p195/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:212:in `const_missing_from_s3_library'
你们有什么想法为什么会这样?我该怎么办?
非常感谢!
答案 0 :(得分:0)
您应该将控制器文件放在
app/admin/pages_controller.rb
但要
app/controllers/admin/pages_controller.rb
和相同的关注视图 - 此控制器中索引操作的默认视图应放在:
app/views/admin/pages/index.html.erb
P.S。您登录的pastebin与您在此处发布的内容不同:
2013-06-20 15:50:04.488 [INFO ] (pid:28961)
2013-06-20 15:50:04.492 [INFO ] (pid:28961)
2013-06-20 15:50:04.496 [INFO ] Started GET "/admin" for 127.0.0.1 at 2013-06-20 15:50:04 -0500 (pid:28961)
2013-06-20 15:50:05.149 [INFO ] Processing by Admin::PagesController#home as HTML (pid:28961)
2013-06-20 15:50:05.166 [DEBUG] User Load (2.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1 (pid:28961)
2013-06-20 15:50:05.534 [ERROR] uninitialized constant Page