denormalize_fields 1.0.0 → 1.0.1

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
  SHA256:
3
- metadata.gz: df06ff7f5808a0b48c771019d622d9d02bfd772077829b1aff1a82ebf6302fe9
4
- data.tar.gz: 83d2f0339a9fceb7242426199ee062900aabfe88a18f252f9690e31773343e49
3
+ metadata.gz: 0236da61bb8d620a30c1d80b5e2915655c3fa172209e48e4a0574319bab02318
4
+ data.tar.gz: 186179fca7937e35b792f44d859c58febe38bdc28c1ea7e41b347a7280919d02
5
5
  SHA512:
6
- metadata.gz: 5318a68a0efb8f6975c815d2eda4c9e158100bfdb5d4cd3a1fc6c480e524315aa48b2b003bdf963a4f42a925dceca58186da2b7cccd3f4b94405dd753123b816
7
- data.tar.gz: 1b60e2d7743d11c2cb3717f4ce1b64295f62b65d1316c325e93e049506375ab7692bbd7030089cd0b1567babc09c3211dafda1a285ddb9d133b7715aba6071d6
6
+ metadata.gz: 18db814fcaaa2e8a8c9dcf48469ab6e464a231157d5e5c8cd23293b8c11279df911ccd591536aab593b3ab9e2507bb87db5ed7de55228cea99434d201c9d53be
7
+ data.tar.gz: 302b99956194d9fd94c47fa60a9aa5198b82fe7052b74f88fcdd87dc8945dd2c44644b217e6c81738df55c71f35804c98f3f4646c940b56a5195ab9cce680af3
@@ -0,0 +1,25 @@
1
+ require 'active_record'
2
+
3
+ module DenormalizeFields
4
+ module AssociationExtension
5
+ OPTION = :denormalize
6
+
7
+ def self.valid_options
8
+ [OPTION]
9
+ end
10
+
11
+ def self.build(model, association)
12
+ return unless options = association.options[OPTION]
13
+
14
+ DenormalizeFields.denormalize(
15
+ fields: options[:fields],
16
+ from: association.active_record,
17
+ onto: association.name,
18
+ prefix: options[:prefix],
19
+ )
20
+ end
21
+ end
22
+ end
23
+
24
+ ActiveRecord::Associations::Builder::Association.extensions <<
25
+ DenormalizeFields::AssociationExtension
@@ -1,3 +1,3 @@
1
1
  module DenormalizeFields
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: denormalize_fields
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janosch Müller
@@ -115,6 +115,7 @@ extensions: []
115
115
  extra_rdoc_files: []
116
116
  files:
117
117
  - lib/denormalize_fields.rb
118
+ - lib/denormalize_fields/association_extension.rb
118
119
  - lib/denormalize_fields/version.rb
119
120
  homepage: https://www.github.com/jaynetics/denormalize_fields
120
121
  licenses: