Guest User

Untitled

a guest
Dec 12th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. # Activate the gem you are reporting the issue against.
  2. gem 'activerecord', '4.2.1'
  3. require 'active_record'
  4. require 'minitest/autorun'
  5. require 'logger'
  6.  
  7. # Ensure backward compatibility with Minitest 4
  8. Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
  9.  
  10. # This connection will do for database-independent bug reports.
  11. #ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
  12. ActiveRecord::Base.establish_connection(adapter: 'postgresql', host: 'localhost', username: 'arel', password: 'arel', database: 'arel_issue')
  13. ActiveRecord::Base.logger = Logger.new(STDOUT)
  14.  
  15. ActiveRecord::Schema.define do
  16. create_table :posts do |t|
  17. end
  18. end unless ActiveRecord::Base.connection.table_exists?(:posts)
  19.  
  20. class Post < ActiveRecord::Base
  21. def self.custom_arel_scope
  22. from(arel_table.create_table_alias(where(id: 1).arel, table_name))
  23. end
  24. end
  25.  
  26. class BugTest < Minitest::Test
  27. def test_pg_binding
  28. assert Post.custom_arel_scope.to_a
  29. end
  30. end
Add Comment
Please, Sign In to add comment