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 +8 -8
- data/CHANGELOG +3 -0
- data/active_hash.gemspec +6 -3
- data/lib/active_hash/version.rb +1 -1
- data/lib/associations/associations.rb +1 -1
- data/spec/associations/associations_spec.rb +7 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjFhNmFkYzdjYTBlYjE0MDM1NWU2YTUwZjY1MWJkN2Q2YmNmNGRiOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
M2RiMDQ0ODQxYTBhMDY2YzQ0YmI5OTgxZjVjNDA0OTMwNTA2OThjMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzI2ODRiYTMxYTI3YWNjMjEyM2JjMjU3ZmRiYmRlMjllYTIzYzJmNzMyOGE2
|
10
|
+
MjZjNzM4MGRhYjhhNTcwMDIxZmI4MTdkNTEzYTg2NDZlOWNmOGQ1MjQ0YTgw
|
11
|
+
MTZiZDE2MmM3ZDk5NmM4MDJmODk1YzNiMDQ0OTJiMjhlOWNjNzg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDI3ZjMzM2UwNmM1N2QyY2ExZGRiZDM4MjFmZTBmMzJiNTU5ZmExOTQ3OGU4
|
14
|
+
ZDc5YjYyZDNmMGE3MjlmMjZkODgzZjNhNzkxM2E5YjEzZjJhNGMxZmQxOTVk
|
15
|
+
MzhkN2ZiYjdiODQ2MjliMGEzNjJkNGZmOWQ2ZThjMzkyZjhhODM=
|
data/CHANGELOG
CHANGED
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<
|
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<
|
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<
|
101
|
+
s.add_dependency(%q<wwtd>)
|
102
|
+
s.add_dependency(%q<rake>)
|
100
103
|
end
|
101
104
|
end
|
data/lib/active_hash/version.rb
CHANGED
@@ -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
|
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.
|
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:
|
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
|
- - ! '>='
|