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 に答える