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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/active_mappers.rb +5 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e9d7b63d23e7e9e8a79b066058c61d64917668cd18f26b476d0895f6794696b
4
- data.tar.gz: f98714d581527d72053252a149368a84969898514f87121e47e2a25628904eb4
3
+ metadata.gz: 3698b3e1164bdab4bfbdf51ba23ccb631343b5b73baf144ee32d1622b865473e
4
+ data.tar.gz: 3ad57ddc57e35f5416654da57eb42529cba0bad53fd5ab373becbcc63513866a
5
5
  SHA512:
6
- metadata.gz: a6fe36f84e215e9166c54afaba45e3b6cf17ebe7f8e314ff5f9ee2af68996aeea2c797437eb5c8babc706d0599b844b6b9439049784bae5e003e5b3d24c0bb42
7
- data.tar.gz: efb87c243721d55659fe3e4169c2b933514e8124571448d452141ccb4cf50f79a6bef148b61e6f13b3285f6fb02da4bc8be3cd5d116e43eccdc310d5e5bbdba9
6
+ metadata.gz: 0a96eb16b3721b917a21997e5989ea6fb7bc412958671eddb537cd730a06e85db1b9773f19e9e6a8b4513bc16ac1777d300b58ead8d124de5003fd5d7a66d45a
7
+ data.tar.gz: 66dc63518b8c1bca6df28b4f39e5c7ecb46b8e7e0a59554abd6a900529534ea180b1927ad777e10b9a29115b4ba9686bcbea9cb5f14b0883d82ecb0b3691d22b
@@ -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
- resource = options[:root] || self.name.gsub('Mapper', '').downcase
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
- { resource.tableize.gsub('/', '_').to_sym => all(args) }
74
+ { resource_name.to_s.pluralize.to_sym => all(args) }
74
75
  else
75
- { resource.to_sym => one(args) }
76
+ { resource_name.to_s.singularize.to_sym => one(args) }
76
77
  end
77
78
  end
78
79
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_mappers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michaël Villeneuve