Every repository with this icon (
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
README.markdown | Sun Jun 29 18:34:06 -0700 2008 | [coderifous] |
| |
init.rb | Sun Jun 29 18:34:06 -0700 2008 | [coderifous] |
| |
lib/ | Wed Jul 02 08:24:30 -0700 2008 | [coderifous] |
| |
test/ | Sun Jun 29 18:34:06 -0700 2008 | [coderifous] |
Basic Rest Actions - Plugin for Rails
Simply adds typical REST actions to a controller.
Synopsis
# For a model named "Shoe" in a controller named Shoes
class ShoesController < ActionController::Base
basic_rest_actions
end
# For a model named "Boots" in a controller named Shoes
class ShoesController < ActionController::Base
basic_rest_actions_for :boots
end
# In your views, you can access the standard model instance variables via
# typically named variables:
# index.html.erb ...
<%= render :partial => 'shoe', :collection => @shoes %>
# show.html.erb ...
Brand: <%= @shoe.brand %>
The standard_respond_to method respects html, xml, and json. That list will grow as needed. You can override standard_respond_to and save_and_respond_to methods if you want to do something magical.
Installing
./script/plugin install git://github.com/coderifous/basic_rest_actions.git
Notes
There is no magic here, it just adds the typical REST action methods to your controller. Feel free to override one or two methods if you need something special. If you need to customize more, then you should consider not using this plugin at all.
MIT License
Copyright (c) 2008 Jim Garvin
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.




