If one was inclined to use the acts_as_yaffle pattern, they would probably use the second one, rather than the heavily cargo-culted first one.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'spec' | |
class MyExampleGroup < Spec::ExampleGroup | |
before(:each) do | |
puts "in before(:each)" | |
my_custom_method | |
end | |
class << self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
gem 'gaffneyc-bunny' | |
require 'bunny' | |
# Example of simple RPC using server named queues | |
Bunny.open do |amqp| | |
# Exchange definition | |
amqp.exchange('reply', :type => :direct) | |
amqp.exchange('out', :type => :direct) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module KingForm | |
# Method for building forms that contain fields for associated models. | |
module NestedFormHelper | |
# Renders the form for nested objects defined via activerecord accepts_nested_attributes_for | |
# | |
# The associated argument can be either an object, or a collection of objects to be rendered. | |
# | |
# An options hash can be specified to override the default behaviors. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sunspot' | |
require 'sunspot/session_proxy/abstract_session_proxy' | |
require 'resque' | |
require 'resque-retry' | |
class SunspotResqueSessionProxy < Sunspot::SessionProxy::AbstractSessionProxy | |
attr_reader :session | |
delegate :config, :delete_dirty?, :dirty?, | |
:new_search, :search, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# backup redis databases to s3 on the engineyard platform | |
require 'zlib' | |
require 'rubygems' | |
require 'crack/json' | |
require 'aws/s3' | |
class Redis2S3 | |
DATABASE = '/db/redis/redis_state.rdb' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby" | |
require 'rake/clean' | |
require 'rake/testtask' | |
task :default => :test | |
Rake::TestTask.new(:test) do |t| | |
t.warning = true | |
t.verbose = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Module dependencies | |
# | |
utils = require './utils' | |
# | |
# @api private | |
# | |
class Mapper | |
constructor: (phases, riak) -> |
With Rails 3.0 released a few weeks ago I've migrated a few apps and I'm constantly finding useful new improvements. One such improvement is the ability to log anything in the same way that Rails internally logs ActiveRecord and ActionView. By default Rails 3 logs look slightly spiffier than those produced by Rails 2.3: (notice the second line has been cleaned up)
Started GET "/" for 127.0.0.1 at Mon Sep 06 01:07:11 -0400 2010
Processing by HomeController#index as HTML
User Load (0.2ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
CACHE (0.0ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
Rendered layouts/_nav.html.erb (363.4ms)
OlderNewer