My Recent Pastes (53 and counting)
Pastes by Pat Allan (53 and counting)
Below are the 15 most recent pasties by Pat Allan.
September 01, 2007
2:36AM EDT
by Pat Allan
View all 71 lines
require "spec/spec_helper" describe "Conditional Fragment Caching in the controller" do ActionController::Base.logger = Logger.new(STDOUT)
September 01, 2007
2:34AM EDT
by Pat Allan
View all 107 lines
require "spec/spec_helper"
describe "Conditional Action Caching" do
before :all do
FileUtils.mkdir_p(FILE_STORE_PATH)
September 01, 2007
2:33AM EDT
by Pat Allan
View all 38 lines
ENV["RAILS_ENV"] = "test" require 'fileutils' require 'action_controller' require 'action_controller/test_process'
August 31, 2007
12:18AM EDT
by Pat Allan
View all 16 lines
module MixinModule
def MixinModule.included?(mod)
mod.class_eval do
alias_method :default_render_file, :render_file
August 30, 2007
11:34PM EDT
by Pat Allan
View all 12 lines
module ActionController
class Base
alias_method :default_render_file, :render_file
def render_file(whatever_params)
August 30, 2007
11:16PM EDT
by Pat Allan
View all 12 lines
module MixinModule
alias_method :default_render_file, :render_file
def render_file(whatever_params)
# do my own thing here
August 29, 2007
8:44AM EDT
by Pat Allan
path = File.dirname(File.expand_path(__FILE__))
require "#{path}/lib/action_controller"
require "#{path}/lib/action_view"
August 28, 2007
10:21AM EDT
by Pat Allan
View all 14 lines
# news/articles controllers
def show
@article = Article.find(:first, :conditions => {:id => params[:id]})
# send to 404 if @article is nil
August 28, 2007
9:53AM EDT
by Pat Allan
map.connect 'reviews/:letter', :controller => 'reviews', :action => 'list', :letter => /^[a-z0]$/ map.connect 'reviews/:id', :controller => 'reviews', :action => 'show', :id => /^[1-9][0-9]*$/
August 22, 2007
9:34PM EDT
by Pat Allan
@trailers = Trailer.find(:all,
:conditions => "title REGEXP '^(the |an |a )?[#{@letter}].*$' AND NOT title REGEXP 'a [^#{@letter}]'")
@trailers = Trailer.find(:all,
:conditions => ["title REGEXP '^(the |an |a )?[:letter].*$' AND NOT title REGEXP 'a [^:letter]'", :letter => @letter])
August 17, 2007
3:20AM EDT
by Pat Allan
View all 35 lines
module ActionController
class Base
def self.caches_action(*actions, &block)
return unless perform_caching
around_filter(ActionCacheFilter.new(*actions, &block))
August 17, 2007
3:11AM EDT
by Pat Allan
View all 28 lines
module ActionController
module Caching
module Actions
class ActionCacheFilter
alias_method :default_before, :before
August 17, 2007
2:55AM EDT
by Pat Allan
View all 28 lines
module ActionController
module Caching
module Actions
class ActionCacheFilter
alias_method :default_before, :before
August 17, 2007
2:39AM EDT
by Pat Allan
View all 21 lines
module ActionController
module Caching
module Actions
class ActionCacheFilter
alias_method :default_before, :before
