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 ApplicationController < ActionController::Base | |
private | |
# To write subdomains on the url helpers: | |
# root_url(nil, {:subdomain => "subdomain"}) | |
def url_for(options = nil) | |
case options | |
when Hash | |
if subdomain = options.delete(:subdomain) |
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
# Mongoid association matchers for RSpec 2.x and 1.x | |
# | |
# Save this file to your spec/support directory | |
# | |
# Usage: | |
# | |
# describe User do | |
# it { should reference_one :profile } | |
# 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
<% form_for(@book, :validations => { :options => { :submitHandler => "function(form){$(form).ajaxSubmit();}" } }) do |b| %> | |
... | |
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
I'm about to open up registration for RailsCamp New England #3 but I | |
would first like to raise some sponsorship. | |
Here is some information about the event: | |
What: Rails Camp New England is back for the 3rd event. The first took | |
place last summer in Maine, the 2nd in Rhode Island. We're continuing | |
the rotation of New England states with Vermont this time. It has been | |
the only continually organized Ruby event in New England. Twice a year | |
about 30 dedicated Rubyists get together for an extended weekend of |
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
function cdgems() { | |
/usr/bin/osascript -e "tell application \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down" | |
/usr/bin/osascript -e "tell application \"Terminal\" to do script with command \"cd $GEM_HOME/gems\" in window 1" | |
/usr/bin/osascript -e "tell application \"System Events\" to tell process \"Terminal\" to keystroke \"k\" using command down" | |
return 0 | |
} | |
alias cdgems=cdgems |
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
## Code | |
100.times do |i| | |
a = (100 * (i / 100.0)).to_s | |
puts a | |
end | |
## Output | |
0.0 | |
1.0 | |
2.0 |
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
source 'http://rubygems.org' | |
gem "i18n", ">= 0.4.0" | |
gem 'rails', '3.0.0' | |
gem "haml" | |
gem "compass" | |
# gem "mongoid", "2.0.0.beta.15" |
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
# Heavily borrowed from ActiveMerchant::Biling::CreditCard | |
# Updated for ActiveModel::Validations | |
class CreditCard | |
include ActiveMerchant::Billing::CreditCardMethods | |
include ActiveModel::Validations | |
include ActiveModel::Validations::Callbacks | |
include ActiveModel::Naming | |
## Attributes |
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 'test/unit' | |
require 'arel' # master | |
require 'active_record' | |
ActiveRecord::Base.establish_connection( | |
:adapter => defined?(JRUBY_VERSION) ? 'jdbcsqlite3' : 'sqlite3', | |
:database => ':memory:' | |
) |
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
INNER JOIN "records_users" ON records_users AND "records_users" AND user_id AND "records_users"."user_id" AND users AND "users" AND id AND "users"."id" AND "records_users"."user_id" = "users"."id" INNER JOIN "records" ON records AND "records" AND id AND "records"."id" AND records_users AND "records_users" AND record_id AND "records_users"."record_id" AND "records"."id" = "records_users"."record_id" |