Created
August 17, 2012 12:25
-
-
Save mickeb/3378438 to your computer and use it in GitHub Desktop.
Squeel bug report
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
#encoding: utf-8 | |
gem 'rails', '3.2.8' | |
gem 'squeel', '1.0.9' | |
require 'active_record' | |
require 'squeel' | |
require 'squeel/version' | |
puts "Active Record #{ActiveRecord::VERSION::STRING}" | |
puts "Squeel #{Squeel::VERSION}" | |
ActiveRecord::Base.establish_connection( | |
:adapter => 'sqlite3', | |
:database => ':memory:' | |
) | |
ActiveRecord::Schema.define do | |
create_table :agents, :force => true do |t| | |
end | |
create_table :products, :force => true do |t| | |
t.belongs_to :agent | |
t.timestamps | |
end | |
end | |
class Agent < ActiveRecord::Base | |
has_many :products | |
end | |
class Product < ActiveRecord::Base | |
belongs_to :agent | |
scope :today, lambda { | |
where{ date(created_at) == Date.today } | |
} | |
end | |
agent = Agent.create() | |
product = Product.create(:agent => agent) | |
puts agent.products.today.to_sql # Exception |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment