RailsConf 2007 - Choose Your Battles and LetIt::REST

Posted by Jake Good
on May 20, 07

Hampton Catlin and Jeffrey Hardy from unspace are going to talk about REST and such… These guys did Haml, Scribbish, and Sass…



Resource-based controllers (incredibly repetitive)…



LetIt::REST -> MakeResourceful



Using it in production… good-to-go…



Action Pattern (what normally happens)




  • load resource objects

  • optional preloads

  • perform modifying action (CUD)

  • respond



Here’s a snippet of code:




class CommentController < ApplicationController
make_resourceful do
build :create, :destroy
belongs_to :post
associate_with :current_user

before :show do
@title = "My awesome title"
end

response_for :show do |format|
format.html { redirect_to current_object }
end
end
end


There will be some code released here: http://hamptoncatlin.com

Comments

Leave a response

Comment