The make_resourceful plugin is a great way to DRY up the 7 RESTful actions common in most controllers. Learn how to use it in this episode.
# products_controller.rb
make_resourceful do
actions :all
response_for :show do |format|
format.html
format.xml { render :xml => current_object.to_xml }
end
end
private
def current_objects
Product.find(:all, :order => 'name')
end
def current_object
@current_object ||= Product.find_by_permalink(params[:id])
end
<!-- edit.html.erb -->
<%= hidden_field_tag '_flash[notice]', "Successfully updated product." %>
分享到:
相关推荐
make_resourceful 收回对控制器的控制权。 让他们很棒。 使它们光滑。 使他们足智多谋。 REST是设计控制器的一种很好的模式,但是它可以重复很多。 谁想要在整个应用程序中写出相同的动作并复制相同的模型查找...
resourceful 是一个 JavaScript 同构资源引擎,是隐藏在模式和验证原型模型中的业务逻辑,支持以下的数据提供:Memory,File-System,CouchDB,MongoDB,REST,socket.io。 特性 数据验证 简单数据模型管理 关系...
Laravel开发-resourceful .zip
Laravel开发-resourceful 为资源创建迁移、种子、请求、控制器、模型和视图
Laravel开发-laravel-resourceful 为资源创建迁移、种子、请求、控制器、模型和视图
资源来自pypi官网。 资源全名:django-oidc-provider-resourceful-0.5.2.zip
var resourceful = require ( 'express-resourceful' ) ; var app = require ( 'express' ) ; resourceful ( app , 'resources' ) ; // runs synchronously 资源目录 资源之路 网址 index.js / users/index.js /...
足智多谋的简单数据库Resourceful 的 SimpleDB 后端。测试要运行测试,您需要添加 AWS 密钥。 这可以通过在运行npm test之前将config/environment.yaml复制到config/test.yaml并添加您的密钥来完成。使用模块有关...
Resourceful是一种基于Symfony2的即用型“快速API开发”(RAPID)设置,可轻松创建REST API。 特征 足智多谋的现成功能包括以下功能: 用户管理。 oAuth2 授权和客户端管理。 i18n和使用Accept-Language标头的...
Resourceful是一个Xcode实用程序,可帮助避免在使用UIImage/NSImage imageNamed:时犯错误。 该方法采用字符串,然后从应用程序包中加载具有该名称的图像。 不幸的是,如果您输入字符串错误,则不会发出警告。 通过...
用法git clone git@github.com:JordanRobinson/resourceful.gitnpm installnpm install nodemon -gnodemon 使用位于根目录中的名为config.json的详细信息创建一个配置文件。 内容应该是这样的: {"rgUsername":"j....
足智多谋的休息资源丰富的 REST 引擎。 使用尝试完成尽可能多的工作。学分作为一部分构建运行。 使用模块。
全栈Hel 从第1部分开始的练习
Develop resourceful backends using Spring Boot and faultless frontends using React. Explore the techniques involved in creating a full stack app by going through a methodical approach. Learn to add ...
Chapter 4: Being Resourceful. (Resource Primer) Chapter 5: Let's Make A Simple Game Chapter 6: Sounding Off! (Creating sound nuggets) Added Link to UMPG and text on the Sound Manager Chapter 7: Real-...
ResourcefulBeesDocs:所有Resourcey Bees文档的位置
BEW1.1-RESTful和资源丰富的MVC架构课程说明本课程涵盖使网络正常运行的三种主要模式或体系结构; REST,资源和MVC。 学生将学习与语言无关的模式,这些模式可在许多常见服务器之间重复。 涵盖的其他关键概念包括...
Learn how to use Odoo, a resourceful, open source business application platform designed to transform and modernize your business About This Book Configure, manage, and customize Odoo to fit the ...
introducing packages which capture – through matrix algebra – elements of learners’ work with more knowledgeable others and resourceful content artefacts. The book provides comprehensive package-...
Microcontroller programmers are, by their nature, truly resourceful beings. They take a fi xed design and create fantastic new products by implementing the microcontroller in a very unique way. ...