My Recent Pastes (26 and counting)
Pastes by Donald Petersen (26 and counting)
Pages: 1 2
Below are the 15 most recent pasties by Donald Petersen.
October 10, 2007
12:53AM EDT
by Donald Petersen
View more (10 lines)
respond_to do |format|
if @post.show_blog_comments << @show_blog_comment
@post.reload
format.html { redirect_to show_blog_post_url(@show, @post) }
format.js { render :action => '/new_comment.rjs' }
October 04, 2007
12:43AM EDT
by Donald Petersen
View more (22 lines)
def crazy_form_tag(&block) puts "Before Crazy Form Tag" yield puts "After Crazy Form Tag" end
October 03, 2007
11:29PM EDT
by Donald Petersen
View more (20 lines)
def self.find(*args)
permalink = args.first if argument_is_permalink?(args.first)
if permalink
show = find_by_permalink(args)
September 22, 2007
11:32PM EDT
by Donald Petersen
View more (24 lines)
def self.find(*args)
first_arg = args.first
if first_arg && args.length == 1
August 09, 2007
1:14PM EDT
by Donald Petersen
View more (6 lines)
require 'rubygems' rescue nil require 'wirble' Wirble.init
August 06, 2007
2:08PM EDT
by Donald Petersen
View more (10 lines)
describe "Something" do
it "should mock a call to an array" do
odontogram = mock("odontogram")
photos = mock("photos")
odontogram.stub!(:photos).and_return(photos)
July 28, 2007
5:52PM EDT
by Donald Petersen
View more (7 lines)
class Fixnum
def to_awesome
"awesome!"
end
end
July 26, 2007
12:30PM EDT
by Donald Petersen
View more (15 lines)
# In rails 1.2, plugins aren't available in the path until they're loaded. # Check to see if the rspec plugin is installed first and require # it if it is. If not, use the gem version. rspec_base = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec/lib') $LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
July 22, 2007
11:14PM EDT
by Donald Petersen
b = (0..23).inject("") do |buffer, hour|
buffer = buffer + hour.to_s
end
puts b
July 12, 2007
11:42PM EDT
by Donald Petersen
View more (80 lines)
# Creates specially named factory methods for easily instantiating new model # objects with a set of preloaded data. The name of the helper methods # are based on the name of the model under test. model_factory_helper # generates several methods that can be used in your specs. #
July 12, 2007
9:59PM EDT
by Donald Petersen
View more (35 lines)
def model_factory_helper(calling_spec, model_class, options)
raise "factory_method requires default_attributes" unless options.has_key?(:default_attributes)
raise "factory_method default_attributes must be a Hash" unless options[:default_attributes].is_a?(Hash)
proper_class_name = model_class.name
June 18, 2007
8:06PM EDT
by Donald Petersen
View more (25 lines)
class PostsController < ApplicationController
make_resourceful do
actions :all
June 18, 2007
8:05PM EDT
by Donald Petersen
View more (33 lines)
class PostsController < ApplicationController
before_filter :login_required, :except => [ :index, :show ]
before_filter :fetch_all_categories, :only => [ :new, :edit, :create, :update ]
make_resourceful do
June 10, 2007
8:07PM EDT
by Donald Petersen
View more (40 lines)
class ThingsController < ApplicationController
make_resourceful do
actions :all
end
