rails_optimizer 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4dbcf811feb6eb7b70788be32435558802e7a318
4
- data.tar.gz: 11a915e895561996d898497b4de9cb0ff98b89e3
3
+ metadata.gz: db7b90fbb9525326b32fbd31cf0a6e441e358ab6
4
+ data.tar.gz: 59e7600fd887d47e4ed0f26c469c7fcc6a0a56d4
5
5
  SHA512:
6
- metadata.gz: aee3b50dfd806091de19ce996854a7a05029f97f4e6fc72d0ed54f322a3f77ed07284f652a9576fdc8ef5fc6ce237f2172080e1729ae17223340b2830a8d1afc
7
- data.tar.gz: 4fc5b1d865a4dbb59987dd6b36c9c8f900a3c5c7e856643f8bb1fbccf45f6efe5c514a1a50adc29531658d8e87219d3db36695fc293e311e63a0f0f8dceca6f7
6
+ metadata.gz: 19c63413174c06fbb9e8687e0fcf449fe03e95b29a2d6bbeaccde376f0c84d55ffb4d3041dfd68448151a8444e242d1018032a447fafd82f6de1e3301d5aaf56
7
+ data.tar.gz: 4db6afa31f33630649aea0db69dbae324ed0bbf03531e2d52e923a9585a6f7235ae244c7baabf321826e1e078644e13107971f04447cb69a6cae00bd3d2f6746
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_optimizer (0.1.2)
4
+ rails_optimizer (0.1.3)
5
5
  activerecord
6
6
  activesupport
7
7
 
@@ -30,12 +30,16 @@ module RailsOptimizer
30
30
  def self.belongs_to(name, scope = nil, **options)
31
31
  super
32
32
  define_method name.to_s do |*args|
33
- super if args.empty?
34
- if options[:polymorphic]
33
+ klass = if options[:polymorphic]
35
34
  read_attribute("#{name}_type".to_sym).classify
36
35
  else
37
36
  name.to_s.classify
38
- end.constantize.select(*args).scoped(scope).finded(self, name)
37
+ end
38
+ if args.empty?
39
+ klass.select('*').scoped(scope).finded(self, name)
40
+ else
41
+ klass.constantize.select(*args).scoped(scope).finded(self, name)
42
+ end
39
43
  end
40
44
  end
41
45
 
@@ -1,3 +1,3 @@
1
1
  module RailsOptimizer
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_optimizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Facundo A. Díaz Martínez