0

我正在处理管理命名空间,移动一些东西,比如用户,将资源发布到管理部分。

在 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'

你们有什么想法为什么会这样吗?我应该怎么办?

非常感谢!

4

1 回答 1

0

You should put your controller file not to

app/admin/pages_controller.rb

but to

app/controllers/admin/pages_controller.rb

and the same concerns views - default view for index action in this controller should be placed to:

app/views/admin/pages/index.html.erb

p.s. your log on pastebin differs from what you've posted here:

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
于 2013-06-21T07:50:20.887 回答