rails_optimizer 0.1.1 → 0.1.6

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: 731a2c0d7fc92dd23ef745335f531f96fca55759
4
- data.tar.gz: 6be9d2d8a3ad6f4dc6a0b53d091f640681e6ac98
3
+ metadata.gz: 251bda842b9bd7397e47653d3295e8870df5e98f
4
+ data.tar.gz: 9fb57d460e2d263244106de84543738c2e2464db
5
5
  SHA512:
6
- metadata.gz: ada08618e48a7687b8d8915a400cfe9741430e77bfec77a1008f25ea9f919bd7bc3c528b7c6e79bec789d61caf0fd1616cdd453bd5c7e3a2501b1532fc697220
7
- data.tar.gz: ff222be044ad80b6a55892e25e12c06442286b4ab3645db9b9189261ecd5de79728d6112acd024ed222f804d73b254d9e3014f5b7b3a159be414ffdd0ee7c06c
6
+ metadata.gz: 6c156ac6ca99836791406c79d3e9b0615caf1f469d4e0b49ca20b39906cb555eb91ed69008dcf70d57aebd0da87a97386ea84fae0ac1f82945bf4995589f9940
7
+ data.tar.gz: 80610029667cf7451440ddf7505f4d0dcb2f8dfbfd7db37379d075d56f3fa5cccada3771cbe863ce291edd14c0cc507a8e80945f9882da41c07f80e4f1d52396
@@ -0,0 +1,57 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rails_optimizer (0.1.5)
5
+ activerecord
6
+ activesupport
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activemodel (5.2.4.4)
12
+ activesupport (= 5.2.4.4)
13
+ activerecord (5.2.4.4)
14
+ activemodel (= 5.2.4.4)
15
+ activesupport (= 5.2.4.4)
16
+ arel (>= 9.0)
17
+ activesupport (5.2.4.4)
18
+ concurrent-ruby (~> 1.0, >= 1.0.2)
19
+ i18n (>= 0.7, < 2)
20
+ minitest (~> 5.1)
21
+ tzinfo (~> 1.1)
22
+ arel (9.0.0)
23
+ concurrent-ruby (1.1.7)
24
+ diff-lcs (1.4.4)
25
+ i18n (1.8.7)
26
+ concurrent-ruby (~> 1.0)
27
+ minitest (5.14.3)
28
+ rake (12.3.3)
29
+ rspec (3.10.0)
30
+ rspec-core (~> 3.10.0)
31
+ rspec-expectations (~> 3.10.0)
32
+ rspec-mocks (~> 3.10.0)
33
+ rspec-core (3.10.1)
34
+ rspec-support (~> 3.10.0)
35
+ rspec-expectations (3.10.1)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.10.0)
38
+ rspec-mocks (3.10.1)
39
+ diff-lcs (>= 1.2.0, < 2.0)
40
+ rspec-support (~> 3.10.0)
41
+ rspec-support (3.10.1)
42
+ thread_safe (0.3.6)
43
+ tzinfo (1.2.9)
44
+ thread_safe (~> 0.1)
45
+
46
+ PLATFORMS
47
+ ruby
48
+
49
+ DEPENDENCIES
50
+ activerecord (~> 5.2)
51
+ activesupport (~> 5.2)
52
+ rails_optimizer!
53
+ rake (~> 12.0)
54
+ rspec (~> 3.0)
55
+
56
+ BUNDLED WITH
57
+ 2.1.4
@@ -2,6 +2,8 @@ require "rails_optimizer/version"
2
2
 
3
3
  module RailsOptimizer
4
4
  class Error < StandardError; end
5
+ extend ActiveSupport::Concern
6
+
5
7
  included do
6
8
  def save
7
9
  if has_changes_to_save?
@@ -28,11 +30,12 @@ module RailsOptimizer
28
30
  def self.belongs_to(name, scope = nil, **options)
29
31
  super
30
32
  define_method name.to_s do |*args|
31
- if options[:polymorphic]
32
- read_attribute("#{name}_type".to_sym).classify
33
+ super if args.empty?
34
+ klass = if options[:polymorphic]
35
+ read_attribute("#{name}_type".to_sym)
33
36
  else
34
- name.to_s.classify
35
- end.constantize.select(:id, *args).scoped(scope).finded(self, name)
37
+ name.to_s
38
+ end.classify.constantize.select(*args).scoped(scope).finded(self, name)
36
39
  end
37
40
  end
38
41
 
@@ -1,3 +1,3 @@
1
1
  module RailsOptimizer
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.6"
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.1
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Facundo A. Díaz Martínez
@@ -50,6 +50,7 @@ files:
50
50
  - ".travis.yml"
51
51
  - CODE_OF_CONDUCT.md
52
52
  - Gemfile
53
+ - Gemfile.lock
53
54
  - LICENSE.txt
54
55
  - README.md
55
56
  - Rakefile