刚开始学Ruby On Rails 看的是那本经典的 Agile Web Development...
我用的是rails 2.0.2
在cart creation一章中我写的所有的代码都没有问题,除了开始的错误是“页面无法找到”。
上网查了一下说是用如下的解决方式即加上两行代码
"model :cart
model :line_item"

如下:

# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
 
 
  helper :all # include all helpers, all the time

  # See ActionController::RequestForgeryProtection for details
  # Uncomment the :secret if you're not using the cookie session store
  protect_from_forgery # :secret => '00df83fd9a7c900f90067f3893d03eb7'\

 
  model :cart
  model :line_item


end

可是再次运行就报了这么一个错误:

NoMethodError
undefined method `model' for ApplicationController:Class

RAILS_ROOT: E:/temp/demoNetBean
posted on 2008-08-19 00:40  Hi Jew  阅读(354)  评论(0编辑  收藏  举报