activerecord-bixformer 0.4.9 → 0.4.10

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: 2997fd363bb3144808f6fc79f37a77e010c545b1
4
- data.tar.gz: 00d3291893753e6115c797e87b9c3be4766f6678
3
+ metadata.gz: 3db69e1e687cb737ae1a261d797265032643d595
4
+ data.tar.gz: 3d5fda5071c5cce61a59b414e0c6ce57b0b6fd50
5
5
  SHA512:
6
- metadata.gz: 25b2c4383f76c590735b67f700d34985954823657360034d0c888d6eb576343533f7e4c1d8e667b42b0adae40d71d9c01c2608aebb96164ef9d3c17463b5b0de
7
- data.tar.gz: 8f8fb5c76740f603cbac2a1a32b6cb22e895079ee62afe69fe9f3d03538b119681d6e197fe084229cf3519181beb7a837024989fe7a34524d3064376c22f4e5a
6
+ metadata.gz: 5a71ced71a841db66584996b40b32c5dcf5d0eea111975ce93de8db701c54ea8b5efa8fb45b586bf4bb0d0076b5de1128437a29ef0ddd2fb3707a5de8bfe736f
7
+ data.tar.gz: ef835276b2d227c9008df48d9a32bf55c46110d3b9b24188ef5fb17c49b079fa3ef51d3ff8dbec2632c32eb5b121768a3ab25ba5dffd3b56ee1bb38c027ac625
@@ -20,6 +20,10 @@ module ActiveRecord
20
20
  value
21
21
  end
22
22
 
23
+ def should_be_included
24
+ nil
25
+ end
26
+
23
27
  private
24
28
 
25
29
  def record_attribute_value(record)
@@ -83,6 +83,10 @@ module ActiveRecord
83
83
  foreign_record&.__send__(foreign_constant.primary_key)
84
84
  end
85
85
 
86
+ def should_be_included
87
+ @model.activerecord_constant.reflections.find { |k, r| r.foreign_key == @name }.first
88
+ end
89
+
86
90
  private
87
91
 
88
92
  def foreign_constant
@@ -87,6 +87,20 @@ module ActiveRecord
87
87
  arr = []
88
88
  hash = {}
89
89
 
90
+ @attributes.each do |attr|
91
+ attr_should_be_included = attr.should_be_included
92
+
93
+ next unless attr_should_be_included
94
+
95
+ if attr_should_be_included.is_a?(::Hash)
96
+ hash.merge!(attr_should_be_included)
97
+ elsif attr_should_be_included.is_a?(::Array)
98
+ arr.push *attr_should_be_included
99
+ else
100
+ arr.push attr_should_be_included
101
+ end
102
+ end
103
+
90
104
  @associations.each do |assoc|
91
105
  assoc_should_be_included = assoc.should_be_included
92
106
 
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Bixformer
3
- VERSION = "0.4.9"
3
+ VERSION = "0.4.10"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-bixformer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.9
4
+ version: 0.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroaki Otsu