active_hash 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- M2M5ZWI2ZDU5YjUxNjI5N2I3ZWYzNDgyMjdjMjRhODNkZWI0YzRkMA==
4
+ YjFhNmFkYzdjYTBlYjE0MDM1NWU2YTUwZjY1MWJkN2Q2YmNmNGRiOQ==
5
5
  data.tar.gz: !binary |-
6
- NGMwOWExMmRhMTZkM2I0ZTk4NGIyYjIwYzg3Yjg0ZTI4ZGM0NGNiNg==
6
+ M2RiMDQ0ODQxYTBhMDY2YzQ0YmI5OTgxZjVjNDA0OTMwNTA2OThjMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZWJhZmY0Yzk3OTZjOWMxNzVkOTRmN2I0M2MwYzRhZWE3MjE0YzdmMWMzMTA5
10
- YTdkZTgxMTVhMjZhM2YzMDQwN2Q1N2FlMzMyZjhkMTZmNWRlMDZjZDgzYWQx
11
- OGZkMzFjODkyYWZhZWVjOTMzZmJmZDkzNjE0ZTNhMTkwMGVjNDE=
9
+ NzI2ODRiYTMxYTI3YWNjMjEyM2JjMjU3ZmRiYmRlMjllYTIzYzJmNzMyOGE2
10
+ MjZjNzM4MGRhYjhhNTcwMDIxZmI4MTdkNTEzYTg2NDZlOWNmOGQ1MjQ0YTgw
11
+ MTZiZDE2MmM3ZDk5NmM4MDJmODk1YzNiMDQ0OTJiMjhlOWNjNzg=
12
12
  data.tar.gz: !binary |-
13
- MDU1MTk5ZDM0NGVhZjM2MzI3Y2ExNjAwZGU0MDBhNmZjYzRiZWZkMTJmNTQw
14
- ZjdjOTVlYmRhZmY1YmIxYmZhNTdjODFmMTU0ZDM1NmQwZDljOWI0YzMzMDE1
15
- MzVmODAwYTljZmJhODlmZmUyYWI5ZWExMTA1OTY1ODM4OGI1ZGU=
13
+ ZDI3ZjMzM2UwNmM1N2QyY2ExZGRiZDM4MjFmZTBmMzJiNTU5ZmExOTQ3OGU4
14
+ ZDc5YjYyZDNmMGE3MjlmMjZkODgzZjNhNzkxM2E5YjEzZjJhNGMxZmQxOTVk
15
+ MzhkN2ZiYjdiODQ2MjliMGEzNjJkNGZmOWQ2ZThjMzkyZjhhODM=
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ 2013-11-29 (v1.2.3)
2
+ - fix bug where active hash would call `.all` on models when setting has_many (grosser)
3
+
1
4
  2013-11-05 (v1.2.2)
2
5
  - fix bug in gemspec that made it impossible to use w/ Rails 4
3
6
 
data/active_hash.gemspec CHANGED
@@ -83,19 +83,22 @@ Gem::Specification.new do |s|
83
83
  s.add_development_dependency(%q<rspec>, ["~> 2.2.0"])
84
84
  s.add_development_dependency(*sqlite_gem)
85
85
  s.add_development_dependency(%q<activerecord>, supported_rails_versions)
86
- s.add_development_dependency(%q<appraisal>)
86
+ s.add_development_dependency(%q<wwtd>)
87
+ s.add_development_dependency(%q<rake>)
87
88
  else
88
89
  s.add_dependency(%q<activesupport>, supported_rails_versions)
89
90
  s.add_dependency(%q<rspec>, ["~> 2.2.0"])
90
91
  s.add_dependency(*sqlite_gem)
91
92
  s.add_dependency(%q<activerecord>, supported_rails_versions)
92
- s.add_dependency(%q<appraisal>)
93
+ s.add_dependency(%q<wwtd>)
94
+ s.add_dependency(%q<rake>)
93
95
  end
94
96
  else
95
97
  s.add_dependency(%q<activesupport>, supported_rails_versions)
96
98
  s.add_dependency(%q<rspec>, ["~> 2.2.0"])
97
99
  s.add_dependency(*sqlite_gem)
98
100
  s.add_dependency(%q<activerecord>, supported_rails_versions)
99
- s.add_dependency(%q<appraisal>)
101
+ s.add_dependency(%q<wwtd>)
102
+ s.add_dependency(%q<rake>)
100
103
  end
101
104
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveHash
2
2
  module Gem
3
- VERSION = "1.2.2"
3
+ VERSION = "1.2.3"
4
4
  end
5
5
  end
@@ -82,7 +82,7 @@ module ActiveHash
82
82
  klass = options[:class_name].constantize
83
83
  primary_key_value = send(options[:primary_key])
84
84
 
85
- if ActiveRecord.const_defined?(:Relation) && klass.all.class < ActiveRecord::Relation
85
+ if ActiveRecord.const_defined?(:Relation) && klass < ActiveRecord::Relation
86
86
  klass.where(options[:foreign_key] => primary_key_value)
87
87
  elsif klass.respond_to?(:scoped)
88
88
  klass.scoped(:conditions => {options[:foreign_key] => primary_key_value})
@@ -116,6 +116,13 @@ describe ActiveHash::Base, "associations" do
116
116
  author.books.published.should == [@book_1]
117
117
  end
118
118
  end
119
+
120
+ it "only uses 1 query" do
121
+ Author.has_many :books
122
+ author = Author.create :id => 1
123
+ Book.should_receive(:find_by_sql)
124
+ author.books.to_a
125
+ end
119
126
  end
120
127
 
121
128
  context "with ActiveHash children" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Dean
@@ -86,7 +86,21 @@ dependencies:
86
86
  - !ruby/object:Gem::Version
87
87
  version: 2.2.2
88
88
  - !ruby/object:Gem::Dependency
89
- name: appraisal
89
+ name: wwtd
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ type: :development
96
+ prerelease: false
97
+ version_requirements: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ - !ruby/object:Gem::Dependency
103
+ name: rake
90
104
  requirement: !ruby/object:Gem::Requirement
91
105
  requirements:
92
106
  - - ! '>='