看板 Ruby 關於我們 聯絡資訊
昨天摸了一天終於又可以用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
poga:把environment改成development就有error message可以看了 05/24 14:11
gasbomb:我的server/script裡面只有三行組態,這也跟書上寫的不一 05/24 14:48
gasbomb:樣說...還是我就把OPTIONS = {...}直接加進去裡面就好? 05/24 14:49
superchris:產生index.html.erb是沒錯的,啟動script/server後 05/24 15:12
superchris:http://localhost:3000/greeting/即可 05/24 15:12
superchris:using Rails 2.3.5 05/24 15:13
TonyQ:你用啥執行? webrick 或 nginx等應該都會有error output/// 05/24 21:08
TonyQ:只看error 500 當然很難找原因囉 :) 05/24 21:08
TonyQ:另外 index.html.erb 是對的. 預設script/server不用改... 05/24 21:09
gasbomb:我用webrick,今天累了,明天再來試試看 XD 05/24 23:14
hellolucky:有在controller定義index嗎 05/24 23:59
hellolucky:還有 去log資料夾裡面找log 應該是production.log吧?! 05/25 00:05
Jcrt:會噴500多半是ruby階段就掛掉,先看看你config/routes.rb 05/27 18:49
Jcrt:有沒有設定 map.root :controller => "greeting" 05/27 18:50