我已经创建了模型,视图和控制器:加入行动,脚手架生成器
$ rails generate scaffold Post name:string title:string content:text
然后我加入后控制器的方法:
def fill_default_data
Post.fill_default_data
end
但是,当我在浏览器中打开http://localhost:3000/posts/fill_default_data我得到的错误:
ActiveRecord::RecordNotFound in PostsController#show
Couldn't find Post with ID=fill_default_data
它看起来像Rails没有看到fill_default_data actio n并使用show方法。我怎样才能添加新的方法脚手架生成的控制器?