File tree 3 files changed +23
-1
lines changed
3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Unreleased
4
4
5
+ ## v1.6.4
6
+ - [ #314 ] ( https://github.com/JsonApiClient/json_api_client/pull/314 ) - Mimic ActiveRecord behavior when destroying a resource:
7
+ * Add ` destroyed? ` method
8
+ * Do not clear resource attributes
9
+ * Return ` false ` on ` persisted? ` after being destroyed
10
+ * Return ` false ` on ` new_record? ` after being destroyed
11
+
5
12
## v1.6.3
6
13
7
14
- [ #312 ] ( https://githup.com/JsonApiClient/json_api_client/pull/312 ) - Don't raise on ` 422 `
Original file line number Diff line number Diff line change @@ -39,14 +39,29 @@ MyApi::Article.where(author_id: 1).all
39
39
MyApi ::Person .where(name: " foo" ).order(created_at: :desc ).includes(:preferences , :cars ).all
40
40
41
41
u = MyApi ::Person .new (first_name: " bar" , last_name: " foo" )
42
+ u.new_record?
43
+ # => true
42
44
u.save
43
45
46
+ u.new_record?
47
+ # => false
48
+
44
49
u = MyApi ::Person .find(1 ).first
45
50
u.update_attributes(
46
51
a: " b" ,
47
52
c: " d"
48
53
)
49
54
55
+ u.persisted?
56
+ # => true
57
+
58
+ u.destroy
59
+
60
+ u.destroyed?
61
+ # => true
62
+ u.persisted?
63
+ # => false
64
+
50
65
u = MyApi ::Person .create(
51
66
a: " b" ,
52
67
c: " d"
Original file line number Diff line number Diff line change 1
1
module JsonApiClient
2
- VERSION = "1.6.3 "
2
+ VERSION = "1.6.4 "
3
3
end
You can’t perform that action at this time.
0 commit comments