[前][次][番号順一覧][スレッド一覧]

rails:1482

From: sono <skymap_sora@y...>
Date: Thu, 10 Aug 2006 10:34:45 +0900 (JST)
Subject: [rails:1482] rails 本の depot アプリケーションに挑戦しています。

こんにちは、はじめまして。
最近rubyとrailsを集中して勉強し始めたsonoといいます。
どうぞよろしくおねがいします。

現在、「railsによるアジャイルウェブアプリケーション開発」本を
読みすすめながら、実際に動かして試しているのですが
85〜86ページあたりのカート作成の部分で
どうしてもエラーが出てしまいます。
本自身は日本語の第一版でした。

エラー内容は以下です。

NameError in StoreController#add_to_cart

undefined local variable or method `product' for LineItem:Class
RAILS_ROOT: script/../config/..

Application Trace | Framework Trace | Full Trace
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:1129:in
`method_missing'
#{RAILS_ROOT}/app/models/line_item.rb:6:in `for_product'
#{RAILS_ROOT}/app/models/cart.rb:11:in `add_product'
app/controllers/store_controller.rb:10:in `add_to_cart'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/base.rb:910:in
`send'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/base.rb:910:in
`perform_action_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/filters.rb:368:in
`perform_action_without_benchmark'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/benchmarking.rb:69:in
`measure'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/rescue.rb:82:in
`perform_action'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/base.rb:381:in
`send'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/base.rb:381:in
`process_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/filters.rb:377:in
`process_without_session_management_support'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/session_management.rb:117:in
`process'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/dispatcher.rb:38:in
`dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/webrick_server.rb:115:in
`handle_dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/webrick_server.rb:81:in
`service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/local/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:144:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:94:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:89:in `each'
/usr/local/lib/ruby/1.8/webrick/server.rb:89:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:79:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:79:in `start'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/webrick_server.rb:67:in
`dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/commands/servers/webrick.rb:59
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/commands/server.rb:30
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require'
script/server:3
Request

Parameters: {"id"=>"2"}

Show session dump

--- 
:cart: !ruby/object:Cart 
  items: []
  tital_price: 0.0
flash: !ruby/hash:ActionController::Flash::FlashHash {}
Response

Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"}


そこで、英語版MLのほうで
http://lists.rubyonrails.org/pipermail/rails/2006-January/012512.html
ここの記事は見つけたのですが、
Cartクラスがおかしいのでは、→複数形の誤植があった?
というようなところまでは読み取ったんですが、
英語力が乏しいのと、英語版の訂正リストを見ようにも日本語版で
該当ページを見つけられませんでした。

この件に付きまして、なにかご存知の方がございましたら
ヒントをいただけませんでしょうか。

よろしくおねがいいたします。

--
ML: rails@r...
使い方: http://QuickML.com/

[前][次][番号順一覧][スレッド一覧]

->    1482 2006-08-10 03:34 [skymap_sora@y...    ] rails 本の depot アプリケーションに挑戦しています。 
      1483 2006-08-10 03:40 ┣[ochi@c...           ]                                       
      1484 2006-08-10 03:45 ┃┗[skymap_sora@y...    ]                                     
      1486 2006-08-10 03:53 ┃ ┗[ochi@c...           ]                                   
      1487 2006-08-10 04:07 ┃  ┗[skymap_sora@y...    ]                                 
      1489 2006-08-10 04:18 ┃   ┗[ochi@c...           ]                               
      1490 2006-08-10 04:59 ┃    ┗[skymap_sora@y...    ]                             
      1491 2006-08-10 05:12 ┃     ┣[ochi@c...           ]                           
      1492 2006-08-10 05:38 ┃     ┃┗[skymap_sora@y...    ]                         
      1493 2006-08-10 06:04 ┃     ┃ ┗[skymap_sora@y...    ]                       
      1495 2006-08-10 06:41 ┃     ┃  ┗[ochi@c...           ]                     
      1496 2006-08-10 07:02 ┃     ┃   ┗[ochi@c...           ]                   
      1497 2006-08-10 07:24 ┃     ┃    ┗[skymap_sora@y...    ]                 
      1498 2006-08-10 07:35 ┃     ┃     ┗[ochi@c...           ]               
      1499 2006-08-10 07:51 ┃     ┃      ┣[skymap_sora@y...    ]             
      1501 2006-08-10 08:01 ┃     ┃      ┃┗[ochi@c...           ]           
      1502 2006-08-10 08:22 ┃     ┃      ┃ ┗[bsdmad@g...         ]         
      1503 2006-08-10 08:41 ┃     ┃      ┃  ┗[skymap_sora@y...    ]       
      1500 2006-08-10 07:56 ┃     ┃      ┗[tyumityumi@g...     ]             
      1504 2006-08-10 09:06 ┃     ┗[yuui.tanaka@n...    ]                           
      1505 2006-08-10 09:18 ┃      ┣[ochi@c...           ]                         
      1506 2006-08-10 09:41 ┃      ┃┗[yuui.tanaka@n...    ]                       
      1507 2006-08-10 09:54 ┃      ┗[skymap_sora@y...    ]                         
      1485 2006-08-10 03:51 ┗[bsdmad@g...         ]                                       
      1488 2006-08-10 04:15  ┗[skymap_sora@y...    ]