大家好,我是一个新人在学习 ror. 从开始做到现在一直都好好的,中间也有过各种报错,自己学会了查看 Log,google+stackoverflow 可以解决。不过昨天碰到的这个问题真是令人蛋碎了.折腾一整天了。还是没有任何办法. 教材用的是安道 ruby on rails tutorial 中文第三版,到第九章第三节,"列出所有用户",即是在首页点击"Users"标签可以查看所创建的所有用户,我的代码和书上保持完全一致. 并且在设立用户的时候,没有采用中文用户名,全是英文用户名。这是报错的页面
运行 rails 的环境背景是 mac os 10.10.3,
gem 列表为
gem 'rails', '4.2.0'
gem 'bcrypt', '3.1.7'
gem 'bootstrap-sass'
gem 'sass-rails', '5.0.0.beta1'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.0.beta2'
gem 'turbolinks', '2.3.0'
gem 'jbuilder', '2.2.3'
gem 'sdoc', '0.4.0', group: :doc
group :development, :test do
gem 'sqlite3', '1.3.9'
gem 'byebug', '3.4.0'
gem 'web-console', '2.0.0.beta3'
gem 'spring', '1.1.3'
end
group :test do
gem 'minitest-reporters', '1.0.5'
gem 'mini_backtrace', '0.1.3'
gem 'guard-minitest', '2.3.1'
end
group :production do
gem 'pg', '0.17.1'
gem 'rails_12factor', '0.0.2'
gem 'puma', '2.11.1'
end
rals -s -e development 下. 终端显示为
Started GET "/users" for ::1 at 2015-05-23 11:05:07 +0800
Processing by UsersController#index as HTML
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
User Load (0.3ms) SELECT "users".* FROM "users"
Rendered users/index.html.erb within layouts/application (5.3ms)
Completed 500 Internal Server Error in 13ms
查看 development.log,得到
Started GET "/users" for ::1 at 2015-05-23 11:05:07 +0800
Processing by UsersController#index as HTML
[1m[36mUser Load (0.2ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 1]]
[1m[35mUser Load (0.3ms)[0m SELECT "users".* FROM "users"
Rendered users/index.html.erb within layouts/application (5.3ms)
Completed 500 Internal Server Error in 13ms
请问我的问题出在哪里呢?