active_type 0.7.2 → 0.7.3
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 867f9ba2138e71a56858e804c2cb186b3bbd72ae
|
4
|
+
data.tar.gz: cf77e9c2d841ecc02fb034f091ec90931eb6f851
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 407e66f1ddc55f9d3d26e43b042892f8d1b6a5ca9b24745da3635debe0c3c518dc0cc6655da758aa77f2ee048dfdcb45cd5a29d073064cc5884bdd3cae62bc8e
|
7
|
+
data.tar.gz: 54ab92aa3841753f910fb978cd3824f1799d57d5b1a8b68c6a083a4971d5e729599567b938dc940c43dc25294a75e62b462d75796a53f99ceaccf9739b09a9bd
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
ActiveType is in a pre-1.0 state. This means that its APIs and behavior are subject to breaking changes without deprecation notices. Until 1.0, version numbers will follow a [Semver][]-ish `0.y.z` format, where `y` is incremented when new features or breaking changes are introduced, and `z` is incremented for lesser changes or bug fixes.
|
6
6
|
|
7
7
|
|
8
|
+
## [0.7.3][] (2017-08-16)
|
9
|
+
|
10
|
+
* `nests_many` / `nests_one` will now work for nested records with non-integer primary keys.
|
11
|
+
|
12
|
+
|
8
13
|
## [0.7.2][] (2017-07-31)
|
9
14
|
|
10
15
|
* Fixed a bug when converting datetimes from certain strings. This occured if the string included an explicit time zone (i.e. `record.date_time = '2017-07-31 12:30+03:00'`), which was not the local time.
|
data/README.md
CHANGED
@@ -129,13 +129,13 @@ end
|
|
129
129
|
If you want to inherit from an ActiveType class, simply do
|
130
130
|
|
131
131
|
```ruby
|
132
|
-
|
133
|
-
|
134
|
-
|
132
|
+
class SignUp < ActiveType::Record[User]
|
133
|
+
# ...
|
134
|
+
end
|
135
135
|
|
136
|
-
|
137
|
-
|
138
|
-
|
136
|
+
class SpecialSignUp < SignUp
|
137
|
+
# ...
|
138
|
+
end
|
139
139
|
```
|
140
140
|
|
141
141
|
### Defaults ####
|
@@ -168,7 +168,7 @@ SignIn.new(email: "tobias@example.org", :nickname => "kratob").nickname # "krato
|
|
168
168
|
|
169
169
|
You can override attribute getters and setters using `super`:
|
170
170
|
|
171
|
-
```
|
171
|
+
```ruby
|
172
172
|
class SignIn < ActiveType::Object
|
173
173
|
|
174
174
|
attribute :email, :string
|
@@ -179,7 +179,7 @@ class SignIn < ActiveType::Object
|
|
179
179
|
end
|
180
180
|
|
181
181
|
def nickname=(value)
|
182
|
-
super(value.
|
182
|
+
super(value.titleize)
|
183
183
|
end
|
184
184
|
|
185
185
|
end
|
@@ -323,7 +323,7 @@ When working with ActiveType you will often find it useful to cast an ActiveReco
|
|
323
323
|
|
324
324
|
Use `ActiveType.cast` for this:
|
325
325
|
|
326
|
-
```
|
326
|
+
```ruby
|
327
327
|
class User < ActiveRecord::Base
|
328
328
|
...
|
329
329
|
end
|
@@ -341,7 +341,7 @@ This is basically like [`ActiveRecord#becomes`](http://apidock.com/rails/v4.2.1/
|
|
341
341
|
|
342
342
|
You can also cast an entire relation (scope) to a relation of an `ActiveType::Record`:
|
343
343
|
|
344
|
-
```
|
344
|
+
```ruby
|
345
345
|
adult_users = User.where('age >= 18')
|
346
346
|
adult_sign_ups = ActiveType.cast(adult_users, SignUp)
|
347
347
|
sign_up = adult_sign_ups.find(1)
|
@@ -17,9 +17,9 @@ module ActiveType
|
|
17
17
|
destroy = truthy?(attributes.delete(:_destroy)) && @allow_destroy
|
18
18
|
|
19
19
|
if id = attributes.delete(:id)
|
20
|
-
assigned_child ||= fetch_child(parent, id
|
20
|
+
assigned_child ||= fetch_child(parent, id)
|
21
21
|
if assigned_child
|
22
|
-
if assigned_child.id == id
|
22
|
+
if assigned_child.id == id
|
23
23
|
assigned_child.attributes = attributes
|
24
24
|
else
|
25
25
|
raise AssignmentError, "child record '#{@target_name}' did not match id '#{id}'"
|
data/lib/active_type/version.rb
CHANGED
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: 0.7.
|
4
|
+
version: 0.7.3
|
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: 2017-
|
12
|
+
date: 2017-08-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|