rails_optimizer 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rails_optimizer.rb +4 -8
- data/lib/rails_optimizer/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: 13f77501d80e64390517d2db18dfc1a3fb81616e
|
4
|
+
data.tar.gz: 997d8440d4c375a378d48275bdcc63f683e3fa39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2380df7b3ed1dd6c38ce960b16f05212b41ec64d5a9f9de3aa24de8e6eeb97d7c71198a0fe1a13c59b2a3fb09404599e9fe560a289e4db51d9142a31624dc4bf
|
7
|
+
data.tar.gz: '08656e5c75acf0e1cf2a6acfd631ae245fce975681e69a23dc1ea36209c8c3c5c586d97f9ada4c4a160743b0a7a4d79aa96860028d47ec185e049745d962e991'
|
data/Gemfile.lock
CHANGED
data/lib/rails_optimizer.rb
CHANGED
@@ -30,16 +30,12 @@ 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 arsg.empty?
|
33
34
|
klass = if options[:polymorphic]
|
34
|
-
read_attribute("#{name}_type".to_sym)
|
35
|
+
read_attribute("#{name}_type".to_sym)
|
35
36
|
else
|
36
|
-
name.to_s
|
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
|
37
|
+
name.to_s
|
38
|
+
end.classify.constantize.select(*args).scoped(scope).finded(self, name)
|
43
39
|
end
|
44
40
|
end
|
45
41
|
|