From 387a131cf3eb9d46de1b4f184b29e2cfd9805be2 Mon Sep 17 00:00:00 2001 From: Ken Collins Date: Mon, 11 Jun 2012 20:32:50 -0400 Subject: [PATCH] Fixes arity problem introduced by rails 3.2.5. Fixes #1 * Also master is now 3.2 only. --- .travis.yml | 3 --- CHANGELOG | 5 +++++ Gemfile | 3 ++- Gemfile.rails-3.1 | 9 --------- Gemfile.rails-3.2 | 9 --------- README.md | 4 ++-- grouped_scope.gemspec | 2 +- lib/grouped_scope.rb | 1 + lib/grouped_scope/arish/relation/predicate_builer.rb | 5 ++--- lib/grouped_scope/version.rb | 2 +- test/helper.rb | 5 ++--- 11 files changed, 16 insertions(+), 32 deletions(-) delete mode 100644 Gemfile.rails-3.1 delete mode 100644 Gemfile.rails-3.2 diff --git a/.travis.yml b/.travis.yml index 1738378..0acac84 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,3 @@ rvm: - 1.9.2 - 1.9.3 - ree -gemfile: -- Gemfile.rails-3.1 -- Gemfile.rails-3.2 diff --git a/CHANGELOG b/CHANGELOG index 083c2bb..0e8d1a0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,11 @@ = master += 3.2.0 + +* ActiveRecord 3.2 only. + + = 3.1.0 * Works with ActiveRecord 3.1 or 3.2 diff --git a/Gemfile b/Gemfile index 36d8810..e45e65f 100644 --- a/Gemfile +++ b/Gemfile @@ -1 +1,2 @@ -eval File.read('Gemfile.rails-3.1') +source :rubygems +gemspec diff --git a/Gemfile.rails-3.1 b/Gemfile.rails-3.1 deleted file mode 100644 index 97d8ae3..0000000 --- a/Gemfile.rails-3.1 +++ /dev/null @@ -1,9 +0,0 @@ -source :rubygems - -spec = eval File.read('grouped_scope.gemspec') -deps = spec.dependencies.map { |dep| {:name => dep.name, :version => dep.requirement.to_s} } - -deps.reject! { |dep| dep[:name] =~ /activerecord/ } -deps.each { |dep| gem dep[:name], dep[:version] } - -gem 'activerecord', '~> 3.1.3' diff --git a/Gemfile.rails-3.2 b/Gemfile.rails-3.2 deleted file mode 100644 index 7d5fc38..0000000 --- a/Gemfile.rails-3.2 +++ /dev/null @@ -1,9 +0,0 @@ -source :rubygems - -spec = eval File.read('grouped_scope.gemspec') -deps = spec.dependencies.map { |dep| {:name => dep.name, :version => dep.requirement.to_s} } - -deps.reject! { |dep| dep[:name] =~ /activerecord/ } -deps.each { |dep| gem dep[:name], dep[:version] } - -gem 'activerecord', '3.2.0.rc1' diff --git a/README.md b/README.md index 03ae641..0d62d6d 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,10 @@ GroupedScope provides an easy way to group objects and to allow those groups to ## Installation -Install the gem with bundler. We follow a semantic versioning format that tracks ActiveRecord's minor version. So this means to use the latest 3.1.x version of GroupedScope with any ActiveRecord 3.1 version. +Install the gem with bundler. We follow a semantic versioning format that tracks ActiveRecord's minor version. So this means to use the latest 3.2.x version of GroupedScope with any ActiveRecord 3.2 version. ```ruby -gem 'grouped_scope', '~> 3.1.0' +gem 'grouped_scope', '~> 3.2.0' ``` diff --git a/grouped_scope.gemspec b/grouped_scope.gemspec index 6b7149e..40f5222 100644 --- a/grouped_scope.gemspec +++ b/grouped_scope.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |s| s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ['lib'] s.rdoc_options = ['--charset=UTF-8'] - s.add_runtime_dependency 'activerecord', '~> 3.1' + s.add_runtime_dependency 'activerecord', '~> 3.2.0' s.add_development_dependency 'sqlite3', '~> 1.3' s.add_development_dependency 'rake', '~> 0.9.2' s.add_development_dependency 'minitest', '~> 2.8.1' diff --git a/lib/grouped_scope.rb b/lib/grouped_scope.rb index ac99566..d9fe974 100644 --- a/lib/grouped_scope.rb +++ b/lib/grouped_scope.rb @@ -1,5 +1,6 @@ require 'active_record' require 'active_record/version' +require 'active_support/all' require 'grouped_scope/errors' require 'grouped_scope/self_grouping' diff --git a/lib/grouped_scope/arish/relation/predicate_builer.rb b/lib/grouped_scope/arish/relation/predicate_builer.rb index d46f179..97ef9b1 100644 --- a/lib/grouped_scope/arish/relation/predicate_builer.rb +++ b/lib/grouped_scope/arish/relation/predicate_builer.rb @@ -9,13 +9,12 @@ module PredicateBuilder end module ClassMethods - - def build_from_hash_with_grouped_scope(engine, attributes, default_table) + def build_from_hash_with_grouped_scope(engine, attributes, default_table, check_column = true) attributes.select{ |column, value| GroupedScope::SelfGroupping === value }.each do |column_value| column, value = column_value attributes[column] = value.arel_table[column.to_s].in(value.ids_sql) end - build_from_hash_without_grouped_scope(engine, attributes, default_table) + build_from_hash_without_grouped_scope(engine, attributes, default_table, check_column) end end diff --git a/lib/grouped_scope/version.rb b/lib/grouped_scope/version.rb index afdb55d..7a7f359 100644 --- a/lib/grouped_scope/version.rb +++ b/lib/grouped_scope/version.rb @@ -1,3 +1,3 @@ module GroupedScope - VERSION = '3.1.2' + VERSION = '3.2.0' end diff --git a/test/helper.rb b/test/helper.rb index bb3b1fc..3b98796 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -1,7 +1,6 @@ require 'rubygems' -require 'bundler' -require "bundler/setup" -Bundler.require +require 'bundler/setup' +Bundler.require :default, :development require 'grouped_scope' require 'minitest/autorun' require 'factories'