activerecord-postgresql-cursors 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{activerecord-postgresql-cursors}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{J Smith}]
12
- s.date = %q{2011-07-11}
12
+ s.date = %q{2011-09-28}
13
13
  s.description = %q{Provides some support for PostgreSQL cursors in ActiveRecord.}
14
14
  s.email = %q{code@zoocasa.com}
15
15
  s.extra_rdoc_files = [
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
30
30
  ]
31
31
  s.homepage = %q{http://github.com/zoocasa/activerecord-postgresql-cursors}
32
32
  s.require_paths = [%q{lib}]
33
- s.rubygems_version = %q{1.8.5}
33
+ s.rubygems_version = %q{1.8.8}
34
34
  s.summary = %q{Provides some support for PostgreSQL cursors in ActiveRecord.}
35
35
 
36
36
  if s.respond_to? :specification_version then
@@ -4,17 +4,15 @@ module ActiveRecord
4
4
  # absolutely should be in our app.
5
5
  class CursorsNotSupported < ActiveRecordError; end
6
6
 
7
- module Associations
8
- module ClassMethods
9
- class JoinDependency
10
- # Extra method we can use to clear out a couple of things in
11
- # JoinDependency so we can use some of the methods for our
12
- # cursors code.
13
- def clear_with_cursor
14
- @reflections = []
15
- @base_records_hash = {}
16
- @base_records_in_order = []
17
- end
7
+ module PostgreSQLCursors
8
+ module JoinDependency
9
+ # Extra method we can use to clear out a couple of things in
10
+ # JoinDependency so we can use some of the methods for our
11
+ # cursors code.
12
+ def clear_with_cursor
13
+ @reflections = []
14
+ @base_records_hash = {}
15
+ @base_records_in_order = []
18
16
  end
19
17
  end
20
18
  end
@@ -1,4 +1,8 @@
1
1
 
2
+ class ActiveRecord::Associations::ClassMethods::JoinDependency
3
+ include ActiveRecord::PostgreSQLCursors::JoinDependency
4
+ end
5
+
2
6
  module ActiveRecord
3
7
  class Base
4
8
  class << self
@@ -1,4 +1,14 @@
1
1
 
2
+ if ActiveRecord::VERSION::STRING >= '3.1'
3
+ class ActiveRecord::Associations::JoinDependency
4
+ include ActiveRecord::PostgreSQLCursors::JoinDependency
5
+ end
6
+ else
7
+ class ActiveRecord::Associations::ClassMethods::JoinDependency
8
+ include ActiveRecord::PostgreSQLCursors::JoinDependency
9
+ end
10
+ end
11
+
2
12
  module ActiveRecord
3
13
  module CursorExtensions
4
14
  extend ActiveSupport::Concern
@@ -45,7 +55,12 @@ module ActiveRecord
45
55
  including = (relation.eager_load_values + relation.includes_values).uniq
46
56
 
47
57
  if including.present?
48
- join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(@klass, including, nil)
58
+ join_dependency = if ActiveRecord::VERSION::STRING >= '3.1'
59
+ ActiveRecord::Associations::JoinDependency.new(@klass, including, [])
60
+ else
61
+ ActiveRecord::Associations::ClassMethods::JoinDependency.new(@klass, including, nil)
62
+ end
63
+
49
64
  join_relation = relation.construct_relation_for_association_find(join_dependency)
50
65
 
51
66
  ActiveRecord::PostgreSQLCursor.new(self, cursor_name, join_relation, join_dependency)
@@ -11,8 +11,6 @@ require 'test/unit'
11
11
  require 'logger'
12
12
  require File.join(File.dirname(__FILE__), *%w{ .. lib activerecord-postgresql-cursors })
13
13
 
14
- puts "Testing against ActiveRecord #{Gem.loaded_specs['activerecord'].version.to_s}"
15
-
16
14
  ActiveRecord::Base.logger = Logger.new("debug.log")
17
15
  ActiveRecord::Base.configurations = {
18
16
  'arunit' => {
@@ -26,6 +24,11 @@ ActiveRecord::Base.configurations = {
26
24
  ActiveRecord::Base.establish_connection 'arunit'
27
25
  ARBC = ActiveRecord::Base.connection
28
26
 
27
+ puts "Testing against ActiveRecord #{Gem.loaded_specs['activerecord'].version.to_s}"
28
+ if postgresql_version = ARBC.query('SELECT version()').flatten.to_s
29
+ puts "PostgreSQL info from version(): #{postgresql_version}"
30
+ end
31
+
29
32
  if !ARBC.table_exists?('foos')
30
33
  ActiveRecord::Migration.create_table(:foos) do |t|
31
34
  t.text :name
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-postgresql-cursors
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - J Smith
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-11 00:00:00 Z
18
+ date: 2011-09-28 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: Provides some support for PostgreSQL cursors in ActiveRecord.
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  requirements: []
68
68
 
69
69
  rubyforge_project:
70
- rubygems_version: 1.8.5
70
+ rubygems_version: 1.8.8
71
71
  signing_key:
72
72
  specification_version: 3
73
73
  summary: Provides some support for PostgreSQL cursors in ActiveRecord.