object_attorney 2.8.0 → 2.8.1

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzU5MTQzODQ3Y2NjMTU0MWVkMzRmOGRmOTMwMTZmZjA4Y2Y1MmQxNw==
4
+ YjBiYjY2NTJjZDkxMzdhMDE4OGExNzM2NGE5NDMzYjVmZmYwYjg2OA==
5
5
  data.tar.gz: !binary |-
6
- ZWRlYWQ3MjdkNmU0YjFjZjM4YzQ3MjAyODhlMzg4MGMwMmEzNDRkZQ==
6
+ NjI5NDA4NGU4YjNkZTJjZTdjZWJkMDNiNjgwZmIxMmIwMzlkOGZlNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDBlNjIzZjBjZTIyZTQ2YzhiNTdhM2Y2OTk3ODNiYmEwZDlmNmNlNDZmMmM1
10
- NjA2YmY5MTk1ODYyNzk0Y2M3ZTFhNGJjNGY3YjYzMGE1NmViNTVkNWEwMzIw
11
- MTZjMTA1ZWE5N2ZlZjE2MTU2NjJkYjYxMDIzOTcyZmZkNTZiNTA=
9
+ MzkxYmE0YTM3ZDdlZTJjZWQyMDQ3YThiZTE4MWNlZTM5NDg0MjhhOTllMjQ5
10
+ YmZlZmRkMGNiY2I3Y2EzN2FhYzEyZmQ0MzY0OWE3ODMwYzg3NmZmZjYxMDYz
11
+ MWRhNjk5ZDQ1NzczNWI4NWI1MTY5YWRmNzI0ODg2NjJlOGVmM2I=
12
12
  data.tar.gz: !binary |-
13
- MjhjZDA5N2Q1MzllMTBjMGExOWI2ODQyNzM2ZjEyY2FlOWZiMTY4YmEyNmRl
14
- NzJlMjRhYzZiNDAzOGY1MTEzNDg5YWFjMGIxNDAzMjRlMDBhMTFlZDEyNzk5
15
- N2EwMTlkYzdkNDM2NTAzMjY3OTIxZTM5OGE3YjY3NDcxZmEzMTg=
13
+ ZTA5YWQwMzBhZjU5ZmVlNDQ0MmUyMjRlYTVjZmEzOTJjODk4YmZlZDcyZmQw
14
+ MWZjYTk5MjQyNDk3OWFlZThmNGE3MjJlNjc0NjMyNmJiNDcwZTZhMWEzNTA3
15
+ NzM0ZmRiMTBhN2YwM2Y3N2YwM2IxMGY0ODBhMTkxMGVjODAxODA=
@@ -20,7 +20,11 @@ module ObjectAttorney
20
20
  module ClassMethods
21
21
 
22
22
  def exposed_getters
23
- @exposed_getters ||= (zuper_method(:exposed_getters) || [])
23
+ return @exposed_getters if defined?(@exposed_getters)
24
+
25
+ @exposed_getters = zuper_method(:exposed_getters)
26
+
27
+ @exposed_getters ||= represented_object_class.present? && represented_object_class.method_defined?(:id) ? [:id] : []
24
28
  end
25
29
 
26
30
  def add_exposed_getters(*getters)
@@ -1,3 +1,3 @@
1
1
  module ObjectAttorney
2
- VERSION = "2.8.0"
2
+ VERSION = "2.8.1"
3
3
  end
@@ -14,8 +14,6 @@ shared_examples "a PostForm with delegated properties" do
14
14
  post_form = described_class.new(params[:post])
15
15
 
16
16
  post_form.save.should == true
17
- described_class.exposed_getters.should == [:title, :user_id]
18
- described_class.exposed_setters.should == [:title, :user_id]
19
17
 
20
18
  Post.all.count.should == 1
21
19
  post = Post.first
@@ -49,8 +47,6 @@ shared_examples "a PostForm with only delegated getters" do
49
47
  post_form = described_class.new(params[:post], post)
50
48
 
51
49
  post_form.save.should == true
52
- described_class.exposed_getters.should == [:title, :user_id]
53
- described_class.exposed_setters.should == []
54
50
 
55
51
  Post.all.count.should == 1
56
52
  post = Post.first
@@ -88,8 +84,6 @@ shared_examples "a PostForm with only delegated setters" do
88
84
  post_form = described_class.new(params[:post], post)
89
85
 
90
86
  post_form.save.should == true
91
- described_class.exposed_getters.should == []
92
- described_class.exposed_setters.should == [:title, :user_id]
93
87
 
94
88
  Post.all.count.should == 1
95
89
  post = Post.first
@@ -14,7 +14,7 @@ describe PostForm::GrandSon do
14
14
  post_form = described_class.new(params[:post], post)
15
15
 
16
16
  post_form.save.should == true
17
- described_class.exposed_getters.should == [:title, :email, :author, :body, :date]
17
+ described_class.exposed_getters.should == [:id, :title, :email, :author, :body, :date]
18
18
  described_class.exposed_setters.should == [:title, :user_id]
19
19
 
20
20
  Post.all.count.should == 1
@@ -33,7 +33,7 @@ describe PostForm::GrandSon do
33
33
  post_form.date.should == '20-10-2010'
34
34
  post_form.respond_to?(:user_id).should == false
35
35
 
36
- data = { title: "altered title", email: "test@gmail.com", author: "test", body: "post body", date: "20-10-2010" }
36
+ data = { id:1, title: "altered title", email: "test@gmail.com", author: "test", body: "post body", date: "20-10-2010" }
37
37
 
38
38
  post_form.exposed_data.should == data
39
39
  post_form.to_json.should == data.to_json
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: object_attorney
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0
4
+ version: 2.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - João Gonçalves