From 51422a9a53b27d353bc670803567f7a156349a01 Mon Sep 17 00:00:00 2001 From: Gordon McNaughton Date: Sat, 12 Sep 2015 09:14:55 -0700 Subject: [PATCH 1/4] Fixes #379 Since polyamorous 1.1.0 [differs from 1.2.0](activerecord-hackery/polyamorous@ca95023) only by the version number and the README file, it's perfectly unacquired to simply change the dependency version. Copied from [5bf84bd](activerecord-hackery/squeel@5bf84b) which is not on the master branch, so can't be referenced. --- squeel.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squeel.gemspec b/squeel.gemspec index bf8a63b..ee96a21 100644 --- a/squeel.gemspec +++ b/squeel.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |s| s.add_dependency 'activerecord', '>= 3.0' s.add_dependency 'activesupport', '>= 3.0' - s.add_dependency 'polyamorous', '~> 1.1.0' + s.add_dependency 'polyamorous', '~> 1.2.0' s.add_development_dependency 'rspec', '~> 2.6.0' s.add_development_dependency 'faker', '~> 0.9.5' s.add_development_dependency 'sqlite3', '~> 1.3.3' From e3fcd1cfe48632f586193dd7924d87cecf5d7aae Mon Sep 17 00:00:00 2001 From: James Reed Date: Mon, 13 Jun 2016 18:04:20 -0700 Subject: [PATCH 2/4] Updating to latest polyamorous in hopes it resolves some other polymorphic joins erros in squeel (#369 and #380). --- squeel.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squeel.gemspec b/squeel.gemspec index ee96a21..ab6e9fe 100644 --- a/squeel.gemspec +++ b/squeel.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |s| s.add_dependency 'activerecord', '>= 3.0' s.add_dependency 'activesupport', '>= 3.0' - s.add_dependency 'polyamorous', '~> 1.2.0' + s.add_dependency 'polyamorous', '~> 1.3.0' s.add_development_dependency 'rspec', '~> 2.6.0' s.add_development_dependency 'faker', '~> 0.9.5' s.add_development_dependency 'sqlite3', '~> 1.3.3' From 5cd30a5ea8d7966c129f9ab0f753a66b210df0d1 Mon Sep 17 00:00:00 2001 From: Gordon McNaughton Date: Wed, 28 Feb 2018 08:54:16 -0500 Subject: [PATCH 3/4] Fix deprecation warnings under ruby-2.4+ ruby 2.4 deprecated Fixnum and Bignum, replacing them with a single unified Integer class. --- lib/squeel/nodes/order.rb | 4 ++-- lib/squeel/visitors/visitor.rb | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/squeel/nodes/order.rb b/lib/squeel/nodes/order.rb index c4d932f..5dc4d31 100644 --- a/lib/squeel/nodes/order.rb +++ b/lib/squeel/nodes/order.rb @@ -5,12 +5,12 @@ class Order < Node # @return The expression being ordered on. Might be an attribute, function, or operation attr_reader :expr - # @return [Fixnum] 1 or -1, depending on ascending or descending direction, respectively + # @return [Integer] 1 or -1, depending on ascending or descending direction, respectively attr_reader :direction # Create a new Order node with the given expression and direction # @param expr The expression to order on - # @param [Fixnum] direction 1 or -1, depending on the desired sort direction + # @param [Integer] direction 1 or -1, depending on the desired sort direction def initialize(expr, direction = 1) raise ArgumentError, "Direction #{direction} is not valid. Must be -1 or 1." unless [-1,1].include? direction @expr, @direction = expr, direction diff --git a/lib/squeel/visitors/visitor.rb b/lib/squeel/visitors/visitor.rb index a6d88a8..e4c68af 100644 --- a/lib/squeel/visitors/visitor.rb +++ b/lib/squeel/visitors/visitor.rb @@ -138,7 +138,7 @@ def visit_without_hash_context_shift(k, v, parent) # object if not passed as an SqlLiteral. def quoted?(object) case object - when Arel::Nodes::SqlLiteral, Bignum, Fixnum, + when Arel::Nodes::SqlLiteral, Integer Arel::SelectManager false when NilClass @@ -208,8 +208,7 @@ def visit_passthrough(object, parent) object end - alias :visit_Fixnum :visit_passthrough - alias :visit_Bignum :visit_passthrough + alias :visit_Integer :visit_passthrough # Visit an array, which involves accepting any values we know how to # accept, and skipping the rest. @@ -448,7 +447,7 @@ def visit_ActiveRecord_Relation(o, parent) # # @param [ActiveRecord::Base] o The AR::Base object to visit # @param parent The current parent object in the context - # @return [Fixnum] The id of the object + # @return [Integer] The id of the object def visit_ActiveRecord_Base(o, parent) o.id end From 0c06d56e4a2346986f172acdf7d26ea85130aa19 Mon Sep 17 00:00:00 2001 From: Gordon McNaughton Date: Wed, 28 Feb 2018 08:55:09 -0500 Subject: [PATCH 4/4] Fix rake errors Fix 'NoMethodError: undefined method `last_comment'' errors when trying to run rake for this gem. Rake 11.0.1 removes the last_comment method which rspec-core (< 3.4.4) uses. Therefore until/if a patch is released we need to pin rake to an older version in Gemfile: gem 'rake', '< 11.0' Then: bundle exec rake install https://stackoverflow.com/questions/35893584/nomethoderror-undefined-method-last-comment-after-upgrading-to-rake-11 --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 10b4d8f..c8c0140 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "http://rubygems.org" gemspec -gem 'rake' +gem 'rake', '< 11.0' rails = ENV['RAILS'] || '4-2-stable' arel = ENV['AREL'] || '6-0-stable'