首页 新闻 论坛 群组 Blog 文档 下载 读书 Tag 网摘 搜索 .NET Java 游戏 视频 人才 外包 培训 数据库 书店 程序员
中国软件网
欢迎您:游客 | 登录 注册 帮助
  • Session问题
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • Anshangcun
    • 等级:
    • 可用分等级:
    • 总技术分:
    • 总技术分排名:
    • 揭贴率:
    发表于:2008-08-19 00:38:12 楼主
    刚开始学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
    20  修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • aotianlong
    • 等级:
    • 可用分等级:
    • 总技术分:
    • 总技术分排名:
    发表于:2008-08-20 00:06:301楼 得分:0
    rails 2.0.2在控制器中没有 model方法了

    如果你的cart.rb跟line_item.rb可以放在RAILS_ROOT/lib下 或者app/models下
    这个位置可以让rails自动载入
    修改 删除 举报 引用 回复

    网站简介广告服务网站地图帮助联系方式诚聘英才English 问题报告
    北京创新乐知广告有限公司 版权所有 京 ICP 证 070598 号
    世纪乐知(北京)网络技术有限公司 提供技术支持
    Copyright © 2000-2008, CSDN.NET, All Rights Reserved