接照《Rolling with Ruby on Rails》示例来做的。
执行
ruby script\generate scaffold recipe title:string instructions:string description:string date:date
后,在生成的recipes_controller.rb文件中增加一list方法,URL中
http://localhost:3000/recipes/list
访问时,提示如下信息
ActiveRecord::RecordNotFound in RecipesController#show
Couldn't find Recipe with ID=list
RAILS_ROOT: E:/ruby/sites/myapp
它可能无法与“http://localhost:3000/recipes/7”即显示某一条记录详细情况的URL区分开。
难道用ruby script\generate scaffold 生成的controller中就不能再增加其它方法了吗?如果能的话,怎么才能增加上呢?
这个问题郁闷了我好久,一直没找到合适的资料说明。
盼高手出手相助,或者推荐相关的资料(我用的是ruby 1.8.6,rails2.1)