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 ActiveRecord | |
class Base | |
def Base.where(*args, &block) | |
#yielding the block will alter the Operations class | |
yield | |
#record altered conditions and values | |
conditions = ::RedQuery::Serializers::Operations.to_sql | |
values = ::RedQuery::Serializers::Operations.values |
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
/Library/Ruby/Gems/1.8/gems/rails-2.3.2/lib/initializer.rb:416:in `initialize_database': undefined method `configurations=' for ActiveRecord::Base:Class (NoMethodError) | |
from /Library/Ruby/Gems/1.8/gems/rails-2.3.2/lib/initializer.rb:141:in `process' | |
from /Library/Ruby/Gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in `send' | |
from /Library/Ruby/Gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in `run' | |
from /Users/johnbender/Sites/happenings/config/environment.rb:17 | |
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' | |
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' | |
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require' | |
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in' | |
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require' |
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
# SQLite version 3.x | |
# gem install sqlite3-ruby (not necessary on OS X Leopard) | |
development: | |
adapter: sqlite3 | |
database: db/development.sqlite3 | |
timeout: 5000 | |
# Warning: The database defined as "test" will be erased and | |
# re-generated from your development database when you run "rake". | |
# Do not set this db to the same as development or production. |
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
# Be sure to restart your server when you modify this file | |
# Uncomment below to force Rails into production mode when | |
# you don't control web/app server and can't set it the proper way | |
# ENV['RAILS_ENV'] ||= 'production' | |
ENV['GEM_PATH'] = '/usr/lib/ruby/gems/1.8:/home/tchob/.gem/ruby/1.8:/Library/Ruby/Gems/1.8:/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8' | |
# Specifies gem version of Rails to use when vendor/rails is not present | |
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION |
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
# Be sure to restart your server when you modify this file | |
# Uncomment below to force Rails into production mode when | |
# you don't control web/app server and can't set it the proper way | |
# ENV['RAILS_ENV'] ||= 'production' | |
ENV['GEM_PATH'] = '/usr/lib/ruby/gems/1.8:/home/tchob/.gem/ruby/1.8:/Library/Ruby/Gems/1.8:/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8' | |
# Specifies gem version of Rails to use when vendor/rails is not present | |
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION |
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 RedQuery | |
module ActiveRecord | |
@@where_mutex = Mutex.new | |
def where(*args, &block) | |
#establish scope for conditions | |
conditions = nil | |
#make sure only one thread at a time is altering the class | |
#variables inside RedQuery::Serializers::Operations |
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
#Users who's last logon was in '05 | |
#ActiveRecord | |
User.find(:all, :conditions => ["last_logon between ? and ?", "2005-01-01", "2005-12-31"]) | |
#rquery | |
User.where { | |
:last_logon.between "2005-01-01", "2005-12-31" | |
} |
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
#where :foo is a column of some table | |
ActiveRecord::Base.where{ | |
:foo.is == "bar" | |
:foo.is > 1 | |
:foo.is < 2 | |
:foo.is >= 3 | |
:foo.is <= 4 | |
:foo.contains "bar" | |
:foo.between 10..20 | |
:foo.from 10, 20 |
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
ActiveRecord::Base.where{ | |
:foo.is_not == "bar" | |
:foo.is_not.between 10..20 | |
:foo.is_not.from 10, 20 | |
:foo.is_not.in 1,2,3,4,5 | |
} |
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
ActiveRecord::Base.where{ | |
:foo.is_not == "bar" | |
:foo.is_not.between 10..20 | |
:foo.is_not.from 10, 20 | |
:foo.is_not.in 1,2,3,4,5 | |
} |