mincer 0.2.4 → 0.2.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: c74759caf1e6c25531831b8826956f646100c748
4
- data.tar.gz: 9aeaeef5b0179d8a5ac4abf8eaedd685babab45b
3
+ metadata.gz: 5b5c443e2818115e62416949527c18a14b8af182
4
+ data.tar.gz: 10906282d26a6690af1655e20e9975446cbf1610
5
5
  SHA512:
6
- metadata.gz: e5a0292afa6da4666085e69d7300aa8c1767a7a622d8152c52586384529dc5d14390008b967bd2f39774636b60e0deb6156f3a50e63db6f77341d916f561f165
7
- data.tar.gz: f9a42a835a506a4d36894f4ac8d42c232fd31672e09479080b1f2f0aa2316fd6a899448d80b813b0e3336c7038384809893e66fa0882cd8a06ab73fbb22fb099
6
+ metadata.gz: 38952e626c0e84e6708aeceebd9d2f5711286df3b508a5fd7f8a7fc05e774f7d1c7ecbd11de0a7e818857dd87c68ec5e226b7be7a2206112f5b2599a7cedc1b7
7
+ data.tar.gz: 9004f37a50fb8a18e3c55ebe8ed39e2bcf846e916f331398723cd5e3453a6f18d7f1273a9d8545149120afab80e5dfa68b28523894fe7e0b8b127915ebbe9843
@@ -7,17 +7,17 @@ module Mincer
7
7
  end
8
8
 
9
9
  def apply
10
- relation = @relation.order(sort_string)
11
- @mincer.sort_attribute, @mincer.sort_order = sort_attr.to_s, order_attr.to_s
12
- relation
10
+ sorting_sting = sort_string
11
+ if sorting_sting.present?
12
+ @mincer.sort_attribute, @mincer.sort_order = sort_attr.to_s, order_attr.to_s
13
+ @relation.order(sorting_sting)
14
+ else
15
+ @relation
16
+ end
13
17
  end
14
18
 
15
19
  def sort_string
16
- if sort_attr
17
- "#{sort_attr} #{order_attr || default_order}"
18
- else
19
- "#{default_sort} #{order_attr || default_order}"
20
- end
20
+ [(sort_attr || default_sort), (order_attr || default_order)].compact.uniq.join(' ')
21
21
  end
22
22
 
23
23
  def sort_attr
@@ -1,7 +1,7 @@
1
1
  module Mincer
2
2
 
3
3
  def self.version
4
- Gem::Version.new '0.2.4'
4
+ Gem::Version.new '0.2.6'
5
5
  end
6
6
 
7
7
  module VERSION #:nodoc:
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency 'activerecord', '= 4.2'
21
+ spec.add_dependency 'activerecord', '~> 4.2'
22
22
 
23
23
  spec.add_development_dependency 'bundler', '~> 1.3'
24
24
  spec.add_development_dependency 'rake'
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mincer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Krasinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-05 00:00:00.000000000 Z
11
+ date: 2015-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.2'
27
27
  - !ruby/object:Gem::Dependency
@@ -196,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
196
  version: '0'
197
197
  requirements: []
198
198
  rubyforge_project:
199
- rubygems_version: 2.2.0
199
+ rubygems_version: 2.4.3
200
200
  signing_key:
201
201
  specification_version: 4
202
202
  summary: ActiveRecord::Relation wrapper for pagination, order, json, search, cache_digest