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 +4 -4
- data/lib/rails2use.rb +8 -6
- data/lib/rails2use/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a2eb6ab0f3fd4cf971cffe0fd403b54c5f8c828
|
4
|
+
data.tar.gz: 5ff21cb2004eacba2459aad8b1cb4ae6fa7e1bf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 108cbaf7fe1012faff430c6ec87a6dd04300ac1329db5d3f5c70d1316fa05e29f8fa6b5f5146638e253805c4d47926aa7e8b53996d545574eeb4c71d8df10891
|
7
|
+
data.tar.gz: 3ba49f7386815e2dada6d87aa79ef7840ac4a920495d9621ad1aae770d7fd515797db1923362b00c71ac5f06618e6da3518ee4cb8a934ac3cde3c5db62543af8
|
data/lib/rails2use.rb
CHANGED
@@ -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
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
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
|
data/lib/rails2use/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2014-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|