dcidev_active_record 0.0.10 → 0.0.11

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: 39ef130c33dba54d43cb868680de1a87e6a21fdd0aa1ec784231b0faad38e998
4
- data.tar.gz: 51bb74f205875eba8875bf1136e8c53ae4b61ef0bf7587224603e809f477ea0b
3
+ metadata.gz: 016dea935c8d62a764c1b5488347d03199304974da1942e868189d446e4ac99e
4
+ data.tar.gz: 62e529217307601d18c3ba0d341ccb90d25e600d50ee13ce7bffdb1706a78850
5
5
  SHA512:
6
- metadata.gz: f6be9964e2b1fee13e235bb9c6ca21dfc9fb2e472cb425ef9afe47e1d2175194c93138b2965c02fca6276ed1a7dd45e9f6b17fc797952cb2044c671888d3f20d
7
- data.tar.gz: 6d5d16730a92f8b577ae7b1d181cd888842590778e74156e292450b9954c1fed0954b6d60c6300b112b4a08fbde85de5922ae6835039f81f3f8a5dbf7f7facae
6
+ metadata.gz: '0886cfce0c6b68ad19035839121a950e578f3a682e84b6b3e986dbdbdbbe64dcbb625cf0f283d8fe44dc82d4528602ac0d2431ceedd7e080c6a4f8928488d8f9'
7
+ data.tar.gz: 70cd0e8ce9ed0ec43393d36e68b4b8c9410b0299cb2ae90373a9c320130c19754f01abc7d97b9f81b7a6843bee3a5507f5a37e3563c8f49f6ccd65fb3b69886a
@@ -0,0 +1,14 @@
1
+ module NestedAttributeHelper
2
+ def init_nested_attributes(reflections)
3
+ reflections.each do |r|
4
+ define_method("#{r}_attributes=") do |attr|
5
+ if attr.present?
6
+ children = []
7
+ attr.each do |child|
8
+ children << r.classify.constantize.find_or_initialize_by(child)
9
+ end
10
+ eval("self.#{r} = children")
11
+ end
12
+ end
13
+ end
14
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dcidev_active_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Punto Damar P
@@ -19,6 +19,7 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - README.md
21
21
  - lib/dcidev_active_record.rb
22
+ - lib/nested_attribute_helper.rb
22
23
  homepage:
23
24
  licenses: []
24
25
  metadata: {}