Skip to content

Instantly share code, notes, and snippets.

Rails 2.3 latest
| AR |
------------------------------------------------------------------
Model#id x100000 | 1.057 |
Model.new (instantiation) x10000 | 0.346 |
Model.new (setting attributes) x10000 | 0.967 |
Model.first x10000 | 3.932 |
Model.all limit(100) x1000 | 10.701 |
Model.all limit(100) with relationship x1000 | 25.143 |
#
# Many thanks to my mentor Bryan Helmkamp and the Rails core,
# specially Jeremy Kemper for their support and helping hang.
#
Hi Emilio Tagua,
We have processed the evaluation for your project named Integrate Active Relation with Ruby on Rails.
Congratulations, from our data it seems that you have successfully passed the Final Evaluations. Please contact your mentor to discuss the results of your evaluation and to plan your goals and development plan for the rest of the program
#!/usr/bin/env ruby -KU
TIMES = (ENV['N'] || 10000).to_i
require 'rubygems'
gem 'addressable', '~>2.0'
gem 'faker', '~>0.3.1'
gem 'rbench', '~>0.2.3'
require 'addressable/uri'
require 'faker'
module ActionView
module Helpers
module AssetTagHelper
private
# def write_asset_file_contents(joined_asset_path, asset_paths)
# FileUtils.mkdir_p(File.dirname(joined_asset_path))
# File.open(joined_asset_path, "w+") { |cache| cache.write(join_asset_file_contents(asset_paths)) }
require 'spec_helper'
module Arel
describe Table do
before do
@relation = Table.new(:users)
end
describe '#to_sql' do
it "manufactures a simple select query" do
1) Failure:
test_dynamic_find_by_attributes_bang(RelationTest)
[./test/cases/relations_test.rb:247:in `test_dynamic_find_by_attributes_bang'
/Users/miloops/Workspace/github/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:60:in `__send__'
/Users/miloops/Workspace/github/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:60:in `run']:
<ActiveRecord::RecordNotFound> exception expected but was
Class: <ActiveRecord::StatementInvalid>
Message: <"PGError: ERROR: invalid input syntax for integer: \"invalid\"\n: SELECT \"authors\".\"id\", \"authors\".\"name\", \"authors\".\"author_address_id\", \"authors\".\"author_address_extra_id\"\nFROM \"authors\"\nWHERE (\"authors\".\"name\" = E'wt' AND \"authors\".\"id\" = E'invalid')\nLIMIT 1">
---Backtrace---
/Users/miloops/Workspace/github/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:211:in `log'
require 'spec_helper'
module Arel
describe Lock do
before do
@relation = Table.new(:users)
end
describe '#to_sql' do
it "manufactures a simple select query lock" do
From 166815cde49599cca0d7d69921abd533984a78d6 Mon Sep 17 00:00:00 2001
From: Emilio Tagua <miloops@gmail.com>
Date: Mon, 28 Dec 2009 17:07:47 -0300
Subject: [PATCH] Fix: count should look for projections in chained relations and perform the count on the given column.
---
.../lib/active_record/relational_calculations.rb | 19 +++++++++++++++++--
activerecord/test/cases/relations_test.rb | 10 +++++++++-
2 files changed, 26 insertions(+), 3 deletions(-)
### M E R R Y M A T Z M A S ###
"/|"\
"/wl)e";eval(\
"A | A"\
"A | A"\
\
"InHhL"\
",Z,%w{-"\
",Y&/LH,L*"\
module PaypalHelper
PAYPAL_API_PEM = File.read(File.join(RAILS_ROOT, 'certs', 'paypal_api.pem'))
# paypal_transfer(100.0, "yacare@example.com", "USD", "Your earnings", "This is a receipt"
def paypal_transfer(amount, email, currency, subject = nil, note = nil)
gateway = ActiveMerchant::Billing::PaypalGateway.new(:login => APP_CONFIG[:paypal_api_username],
:password => APP_CONFIG[:paypal_api_password],
:pem => PAYPAL_API_PEM)
gateway.transfer amount_in_cents(amount), email,
:subject => subject, :note => note, :currency => currency