forest_liana 1.0.0.beta5 → 1.0.0.beta6
Sign up to get free protection for your applications and to get access to all the features.
@@ -4,8 +4,23 @@ module ForestLiana
|
|
4
4
|
class SerializerFactory
|
5
5
|
|
6
6
|
def self.define_serializer(active_record_class, serializer)
|
7
|
-
|
8
|
-
|
7
|
+
class_name = active_record_class.table_name.classify
|
8
|
+
module_name = class_name.deconstantize
|
9
|
+
|
10
|
+
name = module_name if module_name
|
11
|
+
name += class_name.demodulize
|
12
|
+
|
13
|
+
ForestLiana.const_set("#{name}Serializer", serializer)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.get_serializer_name(active_record_class)
|
17
|
+
class_name = active_record_class.table_name.classify
|
18
|
+
module_name = class_name.deconstantize
|
19
|
+
|
20
|
+
name = module_name if module_name
|
21
|
+
name += class_name.demodulize
|
22
|
+
|
23
|
+
"ForestLiana::#{name}Serializer"
|
9
24
|
end
|
10
25
|
|
11
26
|
def serializer_for(active_record_class)
|
@@ -59,7 +59,7 @@ module ForestLiana
|
|
59
59
|
{
|
60
60
|
field: association.name.to_s,
|
61
61
|
type: get_type_for_association(association),
|
62
|
-
reference: "#{association.
|
62
|
+
reference: "#{association.klass.table_name.dasherize}.id",
|
63
63
|
inverseOf: inverse_of(association)
|
64
64
|
}
|
65
65
|
end
|
@@ -89,7 +89,7 @@ module ForestLiana
|
|
89
89
|
if association.options[:polymorphic] == true
|
90
90
|
'*.id'
|
91
91
|
else
|
92
|
-
"#{association.
|
92
|
+
"#{association.klass.table_name.dasherize}.id"
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
data/lib/forest_liana/engine.rb
CHANGED
data/lib/forest_liana/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forest_liana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.beta6
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-08-
|
12
|
+
date: 2015-08-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|