This file contains hidden or 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
namespace :bundler do | |
task :install do | |
run("gem install bundler --source=http://gemcutter.org") | |
end | |
task :symlink_vendor do | |
shared_gems = File.join(shared_path, 'vendor/bundler_gems') | |
release_gems = "#{release_path}/vendor/bundler_gems" | |
%w(cache gems specifications).each do |sub_dir| | |
shared_sub_dir = File.join(shared_gems, sub_dir) |
This file contains hidden or 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
# Don't change this file! | |
# Configure your app in config/environment.rb and config/environments/*.rb | |
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) | |
module Rails | |
class << self | |
def boot! | |
unless booted? | |
preinitialize |
This file contains hidden or 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
bundle_path "vendor/bundler_gems" | |
disable_system_gems | |
gem "rails", '2.3.5' | |
gem 'will_paginate', '2.3.11' | |
gem 'authlogic', '2.1.2' | |
gem 'haml', '2.2.13' | |
gem 'formtastic', '0.9.1' | |
gem 'state_machine', '0.8.0' | |
gem 'RedCloth', '4.2.2' |
This file contains hidden or 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
# The faster suite | |
describe UsersController, "POST #create" do | |
context "user is successfully created" do | |
before :each do | |
user = mock_model User, :deliver_activation_instructions! => true | |
User.should_receive(:new).and_return(user) | |
user.should_receive(:signup!).and_return(true) |
This file contains hidden or 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
@landlord = Landlord.first | |
# generates a SQL query for the associated properties collection | |
@landlord.properties.size # => 30, or whatever | |
@landlord.properties.size # => 30; no additional SQL query generated | |
# generates the following SQL in Rails 2.3.5: | |
# SELECT count(*) AS count_all FROM `properties` WHERE (`properties`.landlord_id = 1) | |
@landlord.properties.count # => 30 |
This file contains hidden or 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 'pp' | |
class Account | |
@@accounts = [] | |
attr_accessor :name | |
attr_reader :sub_accounts, :parent_account | |
# Account.new "Accounts Receivable" do |ar| | |
# ar.sub_account("Cash") | |
# end |
This file contains hidden or 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 'mongo' | |
require 'singleton' | |
# require active_support 2.3.5 | |
gem 'activesupport', '2.3.5' | |
module MongoRailsLogger | |
class Config | |
include Singleton |
This file contains hidden or 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 'mongo_ext' | |
require 'mongo' | |
require 'singleton' | |
require 'pp' | |
RAILS_ENV = 'development' |
This file contains hidden or 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
class PeopleController < ActionController::Base | |
def index | |
@people = Person.all | |
respond_to do |format| | |
format.json { @people.to_json } | |
end | |
end | |
end |
This file contains hidden or 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
1 + 1 # => 2 | |
class Fixnum | |
def +(num) | |
puts "You're playing with fire there buddy!" | |
end | |
end | |
1 + 1 # => "You're playing with fire there buddy!" |