看板 Ruby 關於我們 聯絡資訊
: -- : ※ 發信站: 批踢踢實業坊(ptt.cc) : ◆ From: 125.1.130.183 : 推 hellolucky:是要問程式碼還是問textmate操作? 11/24 21:32 : → hideofuyang:我是要問他怎麼操作的,為什麼同個檔案程式會變不一樣 11/24 22:24 : → hideofuyang:http://tinyurl.com/3639rjx 這個網址的1:44-1:46 11/24 22:26 : → hideofuyang:也一樣,畫面比較清楚,不過他是用MAC 11/24 22:27 : → poga:他不是講了嗎,他直接從別的地方複製貼上... 11/25 00:07 : 推 Jcrt:就照著畫面打吧,那只是複製過來的不是有什麼切換方法 11/25 02:59 : → Jcrt:coding沒有這種捷徑啦~ 11/25 02:59 真的很感謝各位前輩的指導 對於昨晚hellolucky大被我的水球攻擊也感到很不好意思XD 請容忍原諒我這個超級初心者再次提問 目前在作comment這個功能時,出現錯誤了 Showing app/views/posts/show.html.erb where line #20 raised: undefined method `body' for #<Comment:0x3b63de4e> 20: <%= f.text_area :body %> /usr/local/jruby-1.5.5/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/attribute_methods.rb:264:in `method_missing' /usr/local/jruby-1.5.5/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_view/helpers/form_helper.rb:880:in `value_before_type_cast' /usr/local/jruby-1.5.5/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_view/helpers/form_helper.rb:870:in `value_before_type_cast' /usr/local/jruby-1.5.5/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_view/helpers/form_helper.rb:820:in `to_text_area_tag' /usr/local/jruby-1.5.5/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_view/helpers/form_helper.rb:655:in `text_area' /usr/local/jruby-1.5.5/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_view/helpers/form_helper.rb:990:in `text_area' blog/app/views/posts/show.html.erb:20:in `_run_erb_app47views47posts47show46html46erb' blog/app/views/posts/show.html.erb:16:in `_run_erb_app47views47posts47show46html46erb' blog/app/controllers/posts_controller.rb:20:in `show' ------------------------------------------------------------- 他是寫沒有定義body?? 我是完全照著影片一步一步作,也檢查了好幾便 照理說應該不會有問題才對@@ 還煩請前輩們不吝指教 感謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 60.56.229.21
hellolucky:檢查一下資料庫有沒有body欄位 11/25 20:58
hellolucky:然後看一下posts controller的20行寫了什麼 11/25 20:59
hideofuyang:posts controller的20行是respond_to do |format| 11/25 22:06
hideofuyang:DB-MIGRATE裡的裡的裡的create_post裡的及comment 11/25 22:09
hideofuyang:都有body 11/25 22:09
hellolucky:先把那行註解掉可以跑嗎? 11/26 00:02
hideofuyang:<%= f.text_area :body %> 把這行刪掉的話,只有在 11/26 13:01
hideofuyang:進ADD COMMENT畫面時會出錯 11/26 13:03
hideofuyang:原本的話是進已做成的POST時就會出錯 11/26 13:04
hellolucky:有執行過rake db:migrate嗎? 11/26 23:22
hideofuyang:有的 所以我也很納悶,我明天再從頭做一次看看好了 11/26 23:35
yzugsr:跑完migration記得重開web server 11/27 10:24