摘要: 对于下面的这几行,比较难理解,有空再说吧。Our first attempt to do this would be:class ProjectsController < InheritedResources::Base def update update! do |format| unless @project.errors.empty? # failure format.html { redirect_to project_url(@project) } end end endendLooks too verbose, right? We c... 阅读全文
posted @ 2012-02-24 19:13 kelby 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 对下面两个插件有依赖,分别为 HasScope 和 Responders 他们三者安装都很简单,直接 gem install 或者 bundle 就行。对于 controller 中,常见的 flash 提示如 flash[:success] , flash[:failure] 我们可以用 Responders 聪明的我们减少重复造轮子Using responders will set the flash message to :notice and :alert. You can change that through the following configuration value:In 阅读全文
posted @ 2012-02-24 18:51 kelby 阅读(402) 评论(0) 推荐(0) 编辑