object_attorney 2.10.11 → 2.10.12

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
- NTk2MGE5ZjBmYjg2NmE4NWE0Y2UxZWZlYWNiMGE0YmU3ZmJjZTU0Mw==
4
+ MTc4MmFkZGRlZGUyNWI0ZWJhNzBhNDNhMmRlZDc3MDJhOTRmZjcxYQ==
5
5
  data.tar.gz: !binary |-
6
- MjZiMTFhNDFmNTMzMjhmYjlkMTk4NWQ3M2Y0M2FkNTVkMzYxZGJiNg==
6
+ M2M1NGZjZDNhOTVjNTBkYTE1YWI4M2Y4ZmRiYmJhNzViNjg3MzQ5MQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzM0OTM3MmVkYjU0MDE2N2QzMGIzZTQzYTFlZGQxNWMwZDBlNzgxOWY0NTdk
10
- NTQ0NzBjMDM1ZTQxNTc1ZTFiYTZhNTQ5NWU1MWUwMWI3NjQwY2JiZGY2MjJl
11
- NWY1NWVlZjY0MTBjYWZiM2EyODE3MGVlYWEyMGYzNDFlZjdhYTg=
9
+ NWQyNmZmZTM1OGE1NTA5MjQ4MTdiMDRjNjM4MzkzOWZjYjMzMGYxZjcwYmUy
10
+ NDJkYTRmZjE1MzdhMGU4M2M0NzkzZmEyNjgyN2IzZmY1YzA3NGMxN2MxMWFj
11
+ NjdhNDUwMWVlMmVjY2RhODk0OTY4M2I3YjM4ZTAzMDlhMzVjMjI=
12
12
  data.tar.gz: !binary |-
13
- YTk5NzMwNzllMTYwNTFjN2E1NTkxMzI2NTg5NDE1MmY2NGRlNjM2YzY2OGJi
14
- NjU3MTI3ZTIwZDEzMzQ4YWQ4ZGIyZDFhODIzNTg0NTJlN2FmN2M2Zjc4Nzhi
15
- NjAxNjE3NGU5MzYxZTgzMGFhZWExMTkwNjI1YjFjMTM1YjdkNWU=
13
+ YjVkZGQyMmNkYmQ1ZjkwMjc0ZjAwZDgwNTBlYmM0YzJhMjA0YTc5ZmYxMzQ2
14
+ ZGJiMDhmODFmY2ExY2Q1OWFmNGMzYzRlMGNlM2EwNmVmM2FkOTJjODBkODBm
15
+ OTAzNDRmODkwMTg4MzA2NGNkOTk1ZDViMjQ4NThlMjhhM2Q3YTY=
@@ -20,7 +20,7 @@ module ObjectAttorney
20
20
 
21
21
  def validate_represented_object
22
22
  represented_object_valid = Helpers.try_or_return(represented_object, :valid?, true)
23
-
23
+
24
24
  load_errors_from represented_object.errors unless represented_object_valid
25
25
 
26
26
  nested_valid = add_errors_entry_if_nested_invalid
@@ -47,18 +47,24 @@ module ObjectAttorney
47
47
 
48
48
  nested_vs_invalid.empty?
49
49
  end
50
-
50
+
51
51
  def self.included(base)
52
52
  base.extend(ClassMethods)
53
53
  end
54
54
 
55
55
  module ClassMethods
56
56
 
57
+ def table_name
58
+ self.instance_variable_get("@table_name") || represented_object_class.try(:table_name)
59
+ end
60
+
61
+ attr_writer :table_name
62
+
57
63
  def represents(represented_object_name, options = {})
58
64
  self.instance_variable_set("@represented_object_reflection", Reflection.new(represented_object_name, options))
59
65
 
60
66
  define_method(represented_object_name) { represented_object }
61
-
67
+
62
68
  properties(*options[:properties]) if options.include?(:properties)
63
69
  getters(*options[:getters]) if options.include?(:getters)
64
70
  setters(*options[:setters]) if options.include?(:setters)
@@ -1,3 +1,3 @@
1
1
  module ObjectAttorney
2
- VERSION = "2.10.11"
2
+ VERSION = "2.10.12"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: object_attorney
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.11
4
+ version: 2.10.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - João Gonçalves
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-16 00:00:00.000000000 Z
11
+ date: 2014-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler