Skip to content

Instantly share code, notes, and snippets.

View rich's full-sized avatar

Rich Cavanaugh rich

  • Datalot, Inc.
  • Port Saint Lucie, FL
View GitHub Profile
Last login: Sat Jul 26 20:54:27 on ttys007
~ $ mkdir git-bug
~ $ cd git-bug/
~/git-bug $ git init
Initialized empty Git repository in /Users/rich/git-bug/.git/
~/git-bug $ echo "test line one" > readme
~/git-bug $ git add readme
~/git-bug $ git commit -a -m "one"
Created initial commit 541fc1d: one
1 files changed, 1 insertions(+), 0 deletions(-)
From 5a37943331e6a12b81ba55d9014c7481427e9d85 Mon Sep 17 00:00:00 2001
From: Rich Cavanaugh <rich@silverback.local>
Date: Wed, 6 Aug 2008 12:11:20 -0400
Subject: [PATCH] Add the ability to alias a task name so tasks can be named the same as a built in ruby method.
Add specs for this functionality.
---
lib/thor.rb | 10 +++++++---
spec/thor_spec.rb | 17 +++++++++++++++++
2 files changed, 24 insertions(+), 3 deletions(-)
module ActsAsCommentable
module Shoulda
def should_be_commentable
should_have_many :comments
should_have_class_methods :find_comments_for, :find_comments_by_user
should_have_instance_methods :add_comment, :comments_ordered_by_submitted
end
end
end
require 'test_helper'
class AlbumTest < ActiveSupport::TestCase
should_belong_to :profile
should_have_many :entries
should_be_taggable
should_be_commentable
should_be_slugged
end
class Author < ActiveRecord::Base
has_many :books do
def correct
map {|b| b.name}
end
def broken
proxy_target.map {|b| b.name}
end
end
~/Projects/oss/serviceproxy (git::master) $ github pull --merge jeremydurham
/opt/local/lib/ruby/gems/1.8/gems/defunkt-github-0.3.4/bin/../lib/github/command.rb:57:in `exec': Operation not supported - git pull jeremydurham master (Errno::E045)
from /opt/local/lib/ruby/gems/1.8/gems/defunkt-github-0.3.4/bin/../lib/github/command.rb:57:in `send'
from /opt/local/lib/ruby/gems/1.8/gems/defunkt-github-0.3.4/bin/../lib/github/command.rb:57:in `run'
from /opt/local/lib/ruby/gems/1.8/gems/defunkt-github-0.3.4/bin/../lib/github/command.rb:45:in `git_exec'
from /opt/local/lib/ruby/gems/1.8/gems/defunkt-github-0.3.4/lib/commands/commands.rb:109:in `command'
from /opt/local/lib/ruby/gems/1.8/gems/defunkt-github-0.3.4/bin/../lib/github/command.rb:25:in `send'
from /opt/local/lib/ruby/gems/1.8/gems/defunkt-github-0.3.4/bin/../lib/github/command.rb:25:in `call'
from /opt/local/lib/ruby/gems/1.8/gems/defunkt-github-0.3.4/bin/../lib/github.rb:74:in `invoke'
Error during failsafe response: closed stream
[ pid=20176 file=Hooks.cpp:508 time=2009-04-03 10:00:56.78 ]:
Backend process 9361 did not return a valid HTTP response. It returned: [Status]
*** Exception NoMethodError in application (undefined method `[]=' for nil:NilClass) (process 9361):
from /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/passenger-2.1.0/lib/phusion_passenger/rack/request_handler.rb:68:in `process_request'
from /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/passenger-2.1.0/lib/phusion_passenger/abstract_request_handler.rb:197:in `main_loop'
from /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/passenger-2.1.0/lib/phusion_passenger/railz/application_spawner.rb:340:in `start_request_handler'
from /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/passenger-2.1.0/lib/phusion_passenger/railz/application_spawner.rb:298:in `handle_spawn_application'
from /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/pa
class Author < ActiveRecord::Base
acts_as_revisable :on_delete => :revise
end
class AuthorRevision < ActiveRecord::Base
acts_as_revision
end
@author = Author.create(:name => 'Rich')
@author.destroy
def self.included(receiver)
receiver.named_scope :latest_before, lambda {|time| {:conditions => ['created_at < ?', time]}}
end