rails2use 0.0.34 → 0.0.35

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: 7e15aeee9baed352283cf818492784273ff643eb
4
- data.tar.gz: 2f93178a6f1fb54df013533b7a99d422c9862955
3
+ metadata.gz: 5a2eb6ab0f3fd4cf971cffe0fd403b54c5f8c828
4
+ data.tar.gz: 5ff21cb2004eacba2459aad8b1cb4ae6fa7e1bf3
5
5
  SHA512:
6
- metadata.gz: 8120dc90883a46c4b4c88885bb52f62cf808fd3f1733dc0343a8ef687cadcba10f557114624a785d41abeb93d24235403f19dca9852d8a64e22cffb9c2b5cb44
7
- data.tar.gz: e71defbaba9ef25440e65f76dfae3f2db6f070e720403821287f333d26878c03cc9dce1302c7e72eabdee95a96aa9378e3bc459effea80673964249c045548d6
6
+ metadata.gz: 108cbaf7fe1012faff430c6ec87a6dd04300ac1329db5d3f5c70d1316fa05e29f8fa6b5f5146638e253805c4d47926aa7e8b53996d545574eeb4c71d8df10891
7
+ data.tar.gz: 3ba49f7386815e2dada6d87aa79ef7840ac4a920495d9621ad1aae770d7fd515797db1923362b00c71ac5f06618e6da3518ee4cb8a934ac3cde3c5db62543af8
@@ -113,12 +113,14 @@ module Rails2use
113
113
  all_instances.each do |instance|
114
114
  model = instance.class
115
115
  instance_name = "#{model.name.underscore}#{instance.id.to_s}"
116
- model.reflect_on_all_associations(:has_many).each do |association|
117
- association_name = (model.name.to_s+'_'+association.name.to_s).camelcase
118
- foreign_instances = instance.send association.name
119
- foreign_instances = [foreign_instances] unless foreign_instances.is_a?(Enumerable)
120
- foreign_instances.each do |foreign_instance|
121
- @writer.write_association association_name, instance_name, foreign_instance.class.to_s.underscore+foreign_instance.id.to_s
116
+ (model.reflect_on_all_associations(:has_one) + model.reflect_on_all_associations(:has_many)).each do |association|
117
+ unless association.options.keys.include?(:through)
118
+ association_name = (model.name.to_s+'_'+association.name.to_s).camelcase
119
+ foreign_instances = instance.send association.name
120
+ foreign_instances = [foreign_instances] unless foreign_instances.is_a?(Enumerable)
121
+ foreign_instances.compact.each do |foreign_instance|
122
+ @writer.write_association association_name, instance_name, foreign_instance.class.to_s.underscore+foreign_instance.id.to_s
123
+ end
122
124
  end
123
125
  #class_name = association.options.has_key?(:as) && association.options[:as].to_s.camelcase.in?(abstract_classes) ? association.options[:as].to_s.camelcase : association.class_name
124
126
  end
@@ -1,3 +1,3 @@
1
1
  module Rails2use
2
- VERSION = '0.0.34'
2
+ VERSION = '0.0.35'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails2use
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.34
4
+ version: 0.0.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Dudda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-30 00:00:00.000000000 Z
11
+ date: 2014-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler