Skip to content

Instantly share code, notes, and snippets.

***** REQUEST: https://login.salesforce.com//services/oauth2/token?grant_type=password&client_id=xxx&client_secret=yyy&username=zzz&password=ppp
***** RESPONSE: Net::HTTPOK -> {"id":"https://login.salesforce.com/id/00DU0000000JvPWMA0/005U0000000ZZGoIAO","issued_at":"1322951588640","instance_url":"https://momentum-custom-6841.database.com","signature":"sss","access_token":"ttt"}
***** REQUEST: https://momentum-custom-6841.database.com/services/data/v23.0/sobjects/Participant__c/a05U0000000XGdvIAG
***** RESPONSE: Net::HTTPOK -> {"attributes":{"type":"Participant__c","url":"/services/data/v23.0/sobjects/Participant__c/a05U0000000XGdvIAG"},"Id":"a05U0000000XGdvIAG","OwnerId":"005U0000000ZZGoIAO","IsDeleted":false,"Name":"Raymond Gao","CreatedDate":"2011-11-30T16:58:54.000+0000","CreatedById":"005U0000000ZZGoIAO","LastModifiedDate":"2011-12-03T19:45:27.000+0000","LastModifiedById":"005U0000000ZZGoIAO","SystemModstamp":"2011-12-03T19:45:27.000+0000","Email__c":"raygao@are4.us","Date_of_Birth__c":"1972-10-10","Gende
class User < ActiveRecord::Base
has_many :dogs
has_many :videos
has_many :photo
end
class Appearance < ActiveRecord::Base
belongs_to :dog
belongs_to :media, :polymorphic => true
end
class NilClass
def method_missing(method, *args, &block)
nil
end
end
obj = nil
obj.frobrigate # => nil
class CreateZipCodes < ActiveRecord::Migration
def self.up
create_table :zip_codes do |t|
t.string :zip
t.string :city
t.string :state, :limit => 2
t.float :latitude
t.float :longitude
t.string :zip_class
end
class FakeUpload < StringIO
def initialize(path, content_type)
super(File.new(path).read)
@content_type = content_type
@original_filename = Pathname.new(path).basename.to_s
end
def content_type
@content_type
end