active_type 1.4.1 → 1.4.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.3.2.mysql2.lock +2 -2
- data/Gemfile.3.2.sqlite3.lock +2 -2
- data/Gemfile.4.2.mysql2.lock +2 -2
- data/Gemfile.4.2.pg.lock +2 -2
- data/Gemfile.4.2.sqlite3.lock +2 -2
- data/Gemfile.5.2.mysql2.lock +2 -2
- data/Gemfile.5.2.pg.lock +1 -1
- data/Gemfile.5.2.sqlite3.lock +2 -2
- data/Gemfile.6.0.pg.lock +2 -2
- data/lib/active_type/version.rb +1 -1
- data/lib/active_type/virtual_attributes.rb +29 -10
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc8f689fdb28d28edb7fc550d21e0c9d4810f298da570e9e8dc223a028c09dc1
|
4
|
+
data.tar.gz: 7f41ea5cd75b455190740c263f836d42cd268e0ab15e3143c9c8dfedb21e0b04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da0b114cb9f97509bc8becad66a553538cbb362d07f9c8a6f1f17d7298282c302a83f477669110fd564f269b9dda5c2a009df41d40990a030044b90be869b03e
|
7
|
+
data.tar.gz: a9c59ed853ad1972ffd1d13d73eb452945f7c882bff1bc0dec49dec26a4b59c726b14381dd7a75f3905f0a5052906d027e8f500910e9b0395e6bc6a076639193
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
|
5
5
|
## Unreleased changes
|
6
6
|
|
7
|
+
## 1.4.2 (2020-09-17)
|
8
|
+
|
9
|
+
* Fixed: Assigning values to virtual attributes through internal setter methods (e.g. `_write_attribute`) no longer results in "can't write unknown attribute" errors.
|
10
|
+
|
11
|
+
## 1.4.1 (2020-08-05)
|
12
|
+
|
13
|
+
* Fixed: Avoid `Module#parents` deprecation warning on Rails 6. Thanks to @cilim.
|
14
|
+
|
7
15
|
## 1.4.0 (2020-07-27)
|
8
16
|
|
9
17
|
* Extended records now use their own I18n namespace when looking up translations for models or attributes.
|
data/Gemfile.3.2.mysql2.lock
CHANGED
data/Gemfile.3.2.sqlite3.lock
CHANGED
data/Gemfile.4.2.mysql2.lock
CHANGED
data/Gemfile.4.2.pg.lock
CHANGED
data/Gemfile.4.2.sqlite3.lock
CHANGED
data/Gemfile.5.2.mysql2.lock
CHANGED
data/Gemfile.5.2.pg.lock
CHANGED
data/Gemfile.5.2.sqlite3.lock
CHANGED
data/Gemfile.6.0.pg.lock
CHANGED
data/lib/active_type/version.rb
CHANGED
@@ -144,28 +144,47 @@ module ActiveType
|
|
144
144
|
@virtual_attributes_cache ||= {}
|
145
145
|
end
|
146
146
|
|
147
|
-
def
|
147
|
+
def read_existing_virtual_attribute(name, &block_when_not_virtual)
|
148
148
|
if self.singleton_class._has_virtual_column?(name)
|
149
149
|
read_virtual_attribute(name)
|
150
150
|
else
|
151
|
-
|
151
|
+
yield
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
-
|
156
|
-
def _read_attribute(name)
|
155
|
+
def write_existing_virtual_attribute(name, value, &block_when_not_virtual)
|
157
156
|
if self.singleton_class._has_virtual_column?(name)
|
158
|
-
|
157
|
+
write_virtual_attribute(name, value)
|
159
158
|
else
|
160
|
-
|
159
|
+
yield
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def [](name)
|
164
|
+
read_existing_virtual_attribute(name) { super }
|
165
|
+
end
|
166
|
+
|
167
|
+
if ActiveRecord::VERSION::STRING >= '4.2.0'
|
168
|
+
def _read_attribute(name)
|
169
|
+
read_existing_virtual_attribute(name) { super }
|
170
|
+
end
|
171
|
+
else
|
172
|
+
def read_attribute(name)
|
173
|
+
read_existing_virtual_attribute(name) { super }
|
161
174
|
end
|
162
175
|
end
|
163
176
|
|
164
177
|
def []=(name, value)
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
178
|
+
write_existing_virtual_attribute(name, value) { super }
|
179
|
+
end
|
180
|
+
|
181
|
+
if ActiveRecord::VERSION::STRING >= '5.2.0'
|
182
|
+
def _write_attribute(name, value)
|
183
|
+
write_existing_virtual_attribute(name, value) { super }
|
184
|
+
end
|
185
|
+
else
|
186
|
+
def write_attribute(name, value)
|
187
|
+
write_existing_virtual_attribute(name, value) { super }
|
169
188
|
end
|
170
189
|
end
|
171
190
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_type
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Kraze
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-09-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
|
-
rubygems_version: 3.0.
|
126
|
+
rubygems_version: 3.0.3
|
127
127
|
signing_key:
|
128
128
|
specification_version: 4
|
129
129
|
summary: Make any Ruby object quack like ActiveRecord
|