Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Activate the gem you are reporting the issue against.
- gem 'activerecord', '4.2.1'
- require 'active_record'
- require 'minitest/autorun'
- require 'logger'
- # Ensure backward compatibility with Minitest 4
- Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
- # This connection will do for database-independent bug reports.
- #ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
- ActiveRecord::Base.establish_connection(adapter: 'postgresql', host: 'localhost', username: 'arel', password: 'arel', database: 'arel_issue')
- ActiveRecord::Base.logger = Logger.new(STDOUT)
- ActiveRecord::Schema.define do
- create_table :posts do |t|
- end
- end unless ActiveRecord::Base.connection.table_exists?(:posts)
- class Post < ActiveRecord::Base
- def self.custom_arel_scope
- from(arel_table.create_table_alias(where(id: 1).arel, table_name))
- end
- end
- class BugTest < Minitest::Test
- def test_pg_binding
- assert Post.custom_arel_scope.to_a
- end
- end
Add Comment
Please, Sign In to add comment