Skip to content

Commit

Permalink
Merge pull request #22748 from Azzurrio/master
Browse files Browse the repository at this point in the history
Fix NoMethodError preparable for Arel::Visitors::PostgreSQL
  • Loading branch information
matthewd committed Feb 22, 2016
2 parents 3591a00 + babf5d1 commit c901fad
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Expand Up @@ -30,7 +30,7 @@ def cacheable_query(arel) # :nodoc:
def select_all(arel, name = nil, binds = [], preparable: nil)
arel, binds = binds_from_relation arel, binds
sql = to_sql(arel, binds)
if arel.is_a?(String) && preparable.nil?
if !prepared_statements || (arel.is_a?(String) && preparable.nil?)
preparable = false
else
preparable = visitor.preparable
Expand Down
@@ -0,0 +1,22 @@
require "cases/helper"
require "models/developer"

class PreparedStatementsTest < ActiveRecord::PostgreSQLTestCase
fixtures :developers

def setup
@default_prepared_statements = Developer.connection_config[:prepared_statements]
Developer.connection_config[:prepared_statements] = false
end

def teardown
Developer.connection_config[:prepared_statements] = @default_prepared_statements
end

def nothing_raised_with_falsy_prepared_statements
assert_nothing_raised do
Developer.where(id: 1)
end
end

end

0 comments on commit c901fad

Please sign in to comment.