active_mappers 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_mappers.rb +5 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3698b3e1164bdab4bfbdf51ba23ccb631343b5b73baf144ee32d1622b865473e
|
4
|
+
data.tar.gz: 3ad57ddc57e35f5416654da57eb42529cba0bad53fd5ab373becbcc63513866a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a96eb16b3721b917a21997e5989ea6fb7bc412958671eddb537cd730a06e85db1b9773f19e9e6a8b4513bc16ac1777d300b58ead8d124de5003fd5d7a66d45a
|
7
|
+
data.tar.gz: 66dc63518b8c1bca6df28b4f39e5c7ecb46b8e7e0a59554abd6a900529534ea180b1927ad777e10b9a29115b4ba9686bcbea9cb5f14b0883d82ecb0b3691d22b
|
data/lib/active_mappers.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'active_support'
|
2
2
|
require 'active_support/core_ext/object/try'
|
3
3
|
require 'active_support/core_ext/string/inflections'
|
4
|
-
require 'active_support/core_ext/string'
|
5
4
|
require_relative 'core_ext/hash'
|
6
5
|
|
7
6
|
module ActiveMappers
|
@@ -68,11 +67,13 @@ module ActiveMappers
|
|
68
67
|
end
|
69
68
|
|
70
69
|
def self.render_with_root(args, options = {})
|
71
|
-
|
70
|
+
resource_name = options[:root]
|
71
|
+
resource_name ||= self.name.gsub('Mapper', '').tableize.gsub('/', '_').camelize(:lower)
|
72
|
+
|
72
73
|
if args.respond_to?(:each)
|
73
|
-
{
|
74
|
+
{ resource_name.to_s.pluralize.to_sym => all(args) }
|
74
75
|
else
|
75
|
-
{
|
76
|
+
{ resource_name.to_s.singularize.to_sym => one(args) }
|
76
77
|
end
|
77
78
|
end
|
78
79
|
|