Skip to content

Instantly share code, notes, and snippets.

url call:
"/posts/13"
eager_cache([Posts, :show], :store => :action_store) { self.class.build_request(url(:post, @comment.post), :id => @comment.post.id) }
Doesn't return any errors, but doesn't cache either
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
@nitsujw
nitsujw / Gemfile
Created March 18, 2012 02:46
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
gem "tzinfo"
# Let's use thin
@nitsujw
nitsujw / application.rb
Created April 4, 2012 16:36 — forked from bradhe/application.rb
Generates a set of JavaScript functions that behave very similarly to Rails' named routes. Even plays nice with the assets pipeline.
module Sprockets::Helpers::RailsHelper
require File.join(Rails.root, "app", "helpers", "assets_helper.rb")
include AssetsHelper
end
@nitsujw
nitsujw / futures.rb
Created April 26, 2012 01:34 — forked from wycats/0_app.rb
Example of using a simple future library for parallel HTTP requests
require "thread"
class Future
attr_reader :exception, :cancelled
def initialize(&block)
@thread = Thread.new(&block)
@thread.abort_on_exception = false
@exception = nil
@cancelled = false