active_hash 3.2.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -1
- data/lib/active_hash/condition.rb +2 -2
- data/lib/active_hash/relation.rb +6 -2
- data/lib/active_hash/version.rb +1 -1
- data/lib/associations/associations.rb +4 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 993ef228f8c89c89dc8f18087b7ed609dc575e3e6031abd82d18673322d42d0d
|
4
|
+
data.tar.gz: 8871a88db27cc363de8d813d98a1d3f354d83c0cc76c0f0a03fb093e5d8a5226
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4c19f95913358f7a7c46e76871bd3845e7e61d82515e725933f162d5735b5fae5f52aeb376b7a61ae9459640692b335f11312b2ae00d43ba353b55cd3358638
|
7
|
+
data.tar.gz: 07a92392da1c142801aa2f5ed60ffa0b1e7ee8a8638096b7f4dd707d4d98c767082e95cfbc3cebce0da7e189a71246bb7d1a349a730d11cf8e146171cea060e2
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,19 @@
|
|
1
1
|
# active_hash Changelog
|
2
2
|
|
3
|
-
## Version [3.2.
|
3
|
+
## Version [3.2.1] - <sub><sup>2023-08-31</sup></sub>
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- Improve `pp` output for `ActiveHash::Relation`. [#288](https://github.com/active-hash/active_hash/pull/288) @flavorjones
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
|
11
|
+
- Fix relation matching when attribute name collides with a method. [#281](https://github.com/active-hash/active_hash/pull/281) @flavorjones
|
12
|
+
- Fix association reflection in applications that don't use ActiveHash::Associations. [#286](https://github.com/active-hash/active_hash/pull/286) @iberianpig
|
13
|
+
- Fix `ActiveHash::Relation#method_missing` and `#respond_to_missing?` without scopes. [#278](https://github.com/active-hash/active_hash/pull/278) @julianrubisch
|
14
|
+
|
15
|
+
|
16
|
+
## Version [3.2.0] - <sub><sup>2023-05-06</sup></sub>
|
4
17
|
|
5
18
|
- Add Ruby 3.2 to the CI matrix [#275](https://github.com/active-hash/active_hash/pull/275) @petergoldstein
|
6
19
|
- Handle default value of `false` [#274](https://github.com/active-hash/active_hash/pull/274) @ihollander
|
@@ -19,7 +19,7 @@ class ActiveHash::Relation::Condition
|
|
19
19
|
expectation_method = inverted ? :any? : :all?
|
20
20
|
|
21
21
|
constraints.send(expectation_method) do |attribute, expected|
|
22
|
-
value = record.
|
22
|
+
value = record.read_attribute(attribute)
|
23
23
|
|
24
24
|
matches_value?(value, expected)
|
25
25
|
end
|
@@ -41,4 +41,4 @@ class ActiveHash::Relation::Condition
|
|
41
41
|
def normalize(value)
|
42
42
|
value.respond_to?(:to_s) ? value.to_s : value
|
43
43
|
end
|
44
|
-
end
|
44
|
+
end
|
data/lib/active_hash/relation.rb
CHANGED
@@ -22,6 +22,10 @@ module ActiveHash
|
|
22
22
|
spawn.where!(conditions_hash)
|
23
23
|
end
|
24
24
|
|
25
|
+
def pretty_print(pp)
|
26
|
+
pp.pp(entries.to_ary)
|
27
|
+
end
|
28
|
+
|
25
29
|
class WhereChain
|
26
30
|
attr_reader :relation
|
27
31
|
|
@@ -164,13 +168,13 @@ module ActiveHash
|
|
164
168
|
end
|
165
169
|
|
166
170
|
def method_missing(method_name, *args)
|
167
|
-
return super unless klass.scopes
|
171
|
+
return super unless klass.scopes&.key?(method_name)
|
168
172
|
|
169
173
|
instance_exec(*args, &klass.scopes[method_name])
|
170
174
|
end
|
171
175
|
|
172
176
|
def respond_to_missing?(method_name, include_private = false)
|
173
|
-
klass.scopes
|
177
|
+
klass.scopes&.key?(method_name) || super
|
174
178
|
end
|
175
179
|
|
176
180
|
private
|
data/lib/active_hash/version.rb
CHANGED
@@ -3,6 +3,10 @@ module ActiveHash
|
|
3
3
|
|
4
4
|
module ActiveRecordExtensions
|
5
5
|
|
6
|
+
def self.extended(base)
|
7
|
+
require_relative 'reflection_extensions'
|
8
|
+
end
|
9
|
+
|
6
10
|
def belongs_to(name, scope = nil, **options)
|
7
11
|
klass_name = options.key?(:class_name) ? options[:class_name] : name.to_s.camelize
|
8
12
|
klass =
|
@@ -92,7 +96,6 @@ module ActiveHash
|
|
92
96
|
end
|
93
97
|
|
94
98
|
def self.included(base)
|
95
|
-
require_relative "reflection_extensions"
|
96
99
|
base.extend Methods
|
97
100
|
end
|
98
101
|
|
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: 3.2.
|
4
|
+
version: 3.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Dean
|
@@ -26,10 +26,10 @@ authors:
|
|
26
26
|
- Brett Richardson
|
27
27
|
- Rachel Heaton
|
28
28
|
- Keisuke Izumiya
|
29
|
-
autorequire:
|
29
|
+
autorequire:
|
30
30
|
bindir: bin
|
31
31
|
cert_chain: []
|
32
|
-
date: 2023-
|
32
|
+
date: 2023-10-12 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: activesupport
|
@@ -93,7 +93,7 @@ metadata:
|
|
93
93
|
changelog_uri: https://github.com/active-hash/active_hash/blob/master/CHANGELOG.md
|
94
94
|
source_code_uri: http://github.com/active-hash/active_hash
|
95
95
|
bug_tracker_uri: https://github.com/active-hash/active_hash/issues
|
96
|
-
post_install_message:
|
96
|
+
post_install_message:
|
97
97
|
rdoc_options: []
|
98
98
|
require_paths:
|
99
99
|
- lib
|
@@ -108,8 +108,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
|
-
rubygems_version: 3.
|
112
|
-
signing_key:
|
111
|
+
rubygems_version: 3.4.19
|
112
|
+
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: An ActiveRecord-like model that uses a hash or file as a datasource
|
115
115
|
test_files: []
|