惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Engineering at Meta
Engineering at Meta
D
DataBreaches.Net
月光博客
月光博客
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
U
Unit 42
腾讯CDC
爱范儿
爱范儿
J
Java Code Geeks
有赞技术团队
有赞技术团队
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
B
Blog
Stack Overflow Blog
Stack Overflow Blog
GbyAI
GbyAI
T
The Blog of Author Tim Ferriss
小众软件
小众软件
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
Microsoft Azure Blog
Microsoft Azure Blog
T
Tailwind CSS Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

博客园 - Hi Jew

IDL实现的元胞自动机模型 Conway Life Game 随笔 Rails 语法笔记 - Hi Jew BizTalk Server : 提高 BizTalk 编程能力的 8 点技巧和窍门 Update SQL Server database with Updategrams 深入biztalk中sql adapter Ivar Jacobson .net如何连接oracle数据库 怎样用Codematic 连接Oracle数据库 数据库连接字符串大全 ASP.NET2.0 Provider模型(上) ——原理、模型与分析 什么是J2EE .net 和 j2ee的区别 IIS5.0和IIS6.0 Apache 或者 Apache.exe Oracle.EXE JAVA虚拟机 JAVA.exe进程 Windows XP/2003系统服务优化 安装Windows server 2003系统后无法安装显卡驱动的解决办法 (转载)
Cart creation 中的Ruby session问题
Hi Jew · 2008-08-19 · via 博客园 - Hi Jew

刚开始学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