[RoR ] 一個關於版本的問題

看板Ruby作者 (胖丁)時間14年前 (2010/05/24 14:09), 編輯推噓3(3011)
留言14則, 6人參與, 最新討論串1/1
昨天摸了一天終於又可以用Ruby寫猜數字或是井字遊戲之類的小遊戲啦 所以打算馬上實戰Rails Windows Vista SP2 Ruby 1.9.1 Rails 2.3.6 我要generate新的controller跟view的時候 Z:\ror\test>ruby script/generate controller Greeting index exists app/controllers/ exists app/helpers/ create app/views/greeting exists test/functional/ create test/unit/helpers/ create app/controllers/greeting_controller.rb create test/functional/greeting_controller_test.rb create app/helpers/greeting_helper.rb create test/unit/helpers/greeting_helper_test.rb create app/views/greeting/index.html.erb 我手上O社的書範例是產生一個index.rhtml 剛剛跑了一下書店翻了其他Rails的書,通通都跟現在的Rails版本不合 我也上網查了一下文件http://guides.rubyonrails.org/getting_started.html 裡面的說法是把index.html.erb改成 <h1>Hello, Rails!</h1> 就可以看到結果了 可是我依樣畫葫蘆得到的結果永遠是 We're sorry, but something went wrong. 問題到底在哪邊咧? 不好意思我每次都來問這麼基本的問題 Orz -- ╔═ ═╦╦═════╦═════╗ ◤◤◤ ╠╣飛鳥ももこ╠═╗ ║ ║╚═════╝ ╚═╦═╣ ║╔══════╗╔═╩═╣ █◤ ╠╣Momoko Asuka╠╝ ║ ◣◢◣◢╩╩══════╩════╝ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 60.245.10.129

05/24 14:11, , 1F
把environment改成development就有error message可以看了
05/24 14:11, 1F

05/24 14:48, , 2F
我的server/script裡面只有三行組態,這也跟書上寫的不一
05/24 14:48, 2F

05/24 14:49, , 3F
樣說...還是我就把OPTIONS = {...}直接加進去裡面就好?
05/24 14:49, 3F

05/24 15:12, , 4F
產生index.html.erb是沒錯的,啟動script/server後
05/24 15:12, 4F

05/24 15:12, , 5F
05/24 15:12, 5F

05/24 15:13, , 6F
using Rails 2.3.5
05/24 15:13, 6F

05/24 21:08, , 7F
你用啥執行? webrick 或 nginx等應該都會有error output///
05/24 21:08, 7F

05/24 21:08, , 8F
只看error 500 當然很難找原因囉 :)
05/24 21:08, 8F

05/24 21:09, , 9F
另外 index.html.erb 是對的. 預設script/server不用改...
05/24 21:09, 9F

05/24 23:14, , 10F
我用webrick,今天累了,明天再來試試看 XD
05/24 23:14, 10F

05/24 23:59, , 11F
有在controller定義index嗎
05/24 23:59, 11F

05/25 00:05, , 12F
還有 去log資料夾裡面找log 應該是production.log吧?!
05/25 00:05, 12F

05/27 18:49, , 13F
會噴500多半是ruby階段就掛掉,先看看你config/routes.rb
05/27 18:49, 13F

05/27 18:50, , 14F
有沒有設定 map.root :controller => "greeting"
05/27 18:50, 14F
文章代碼(AID): #1B-XWC6i (Ruby)