carload 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/carload/engine.rb +15 -15
- data/lib/carload/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5d1d3a7f3e97896ff9b45fa30f927c1a756c296
|
4
|
+
data.tar.gz: 46caa37af3202cadadf73b9fc0bdaaab897fd836
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f34d338ed639ed46ffdd1a12b88a5a1968db40000e570342ac3918e550238408a4d5cd44501fab8c2f51546aeb8cd8af6134397ce6301a0164773ccdaedbb19
|
7
|
+
data.tar.gz: 7d3d656a076f377364a49ff78aa853108a7369f95ca43e1aab7ef3d8604ada87e7156379a404c28215ee38077f9f6511432aac80a88ba72a413c8aec9a7ea291
|
data/lib/carload/engine.rb
CHANGED
@@ -53,23 +53,23 @@ module Carload
|
|
53
53
|
}
|
54
54
|
end
|
55
55
|
end
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
end
|
65
|
-
spec.klass.class_eval do
|
66
|
-
class_eval <<-RUBY
|
67
|
-
def self.#{associated_model[:name].to_s.pluralize}
|
68
|
-
#{polymorphic_objects}
|
69
|
-
end
|
70
|
-
RUBY
|
56
|
+
end
|
57
|
+
# Reopen model classes to handle polymorphic association.
|
58
|
+
Dashboard.models.each do |name, spec|
|
59
|
+
spec.associated_models.values.select { |x| x[:polymorphic] == true }.each do |associated_model|
|
60
|
+
polymorphic_objects = []
|
61
|
+
associated_model[:instance_models].each do |instance_model|
|
62
|
+
Dashboard.model(instance_model).klass.all.each do |object|
|
63
|
+
polymorphic_objects << ["#{object.class} - #{object.send(associated_model[:choose_by])}", "#{object.id},#{object.class}"]
|
71
64
|
end
|
72
65
|
end
|
66
|
+
spec.klass.class_eval do
|
67
|
+
class_eval <<-RUBY
|
68
|
+
def self.#{associated_model[:name].to_s.pluralize}
|
69
|
+
#{polymorphic_objects}
|
70
|
+
end
|
71
|
+
RUBY
|
72
|
+
end
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
data/lib/carload/version.rb
CHANGED