active_type 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b5a76b77fa9b0ebd6d4848a56f7029f164aa482
4
- data.tar.gz: a9dc6dcfba3488aa7a93a0b4d31f7d94e5d62938
3
+ metadata.gz: 867f9ba2138e71a56858e804c2cb186b3bbd72ae
4
+ data.tar.gz: cf77e9c2d841ecc02fb034f091ec90931eb6f851
5
5
  SHA512:
6
- metadata.gz: c3009761aea806e2c41e231bf01e3fdf875398e7defaa267d90294c2cf9c05ebc71690cc0500437ec889192fc644e720d234c349835e327c0e1417c4d2320ca1
7
- data.tar.gz: 9cb6903641b55d50b83d80d6ca1b2335347cebf8956a00bb1e775eaf6cd445228321ca6f504de94c8e67210bfc93943e05715d3575e2814e523dca8e390f14f8
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
- class SignUp < ActiveType::Record[User]
133
- # ...
134
- end
132
+ class SignUp < ActiveType::Record[User]
133
+ # ...
134
+ end
135
135
 
136
- class SpecialSignUp < SignUp
137
- # ...
138
- end
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.titeleize)
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)
@@ -31,7 +31,7 @@ module ActiveType
31
31
  destroy = truthy?(attributes.delete(:_destroy)) && @allow_destroy
32
32
 
33
33
  if id = attributes.delete(:id)
34
- child = fetch_child(parent, id.to_i)
34
+ child = fetch_child(parent, id)
35
35
  if destroy
36
36
  child.mark_for_destruction
37
37
  else
@@ -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.to_i)
20
+ assigned_child ||= fetch_child(parent, id)
21
21
  if assigned_child
22
- if assigned_child.id == id.to_i
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}'"
@@ -1,3 +1,3 @@
1
1
  module ActiveType
2
- VERSION = '0.7.2'
2
+ VERSION = '0.7.3'
3
3
  end
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.2
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-07-31 00:00:00.000000000 Z
12
+ date: 2017-08-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler