ximate 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,12 +13,16 @@ module ActiveRecord
13
13
  end
14
14
 
15
15
  def order(*args)
16
- if !@ranks.empty? && args[0] =~ /^rank/i
17
- tokens = args[0].split(' ')
18
- verse = tokens[1] if tokens[1] =~ /^(asc|desc)$/i
19
- verse ||= 'ASC'
20
- id_ordered = @ranks.keys.sort{|x,y| @ranks[x] <=> @ranks[y]}
21
- orig_order("FIELD(id,#{id_ordered.join(',')}) #{verse}")
16
+ if args[0] =~ /^rank/i
17
+ unless @ranks.empty?
18
+ tokens = args[0].split(' ')
19
+ verse = tokens[1] if tokens[1] =~ /^(asc|desc)$/i
20
+ verse ||= 'ASC'
21
+ id_ordered = @ranks.keys.sort{|x,y| @ranks[x] <=> @ranks[y]}
22
+ orig_order("FIELD(id,#{id_ordered.join(',')}) #{verse}")
23
+ else
24
+ scoped
25
+ end
22
26
  else
23
27
  orig_order(args)
24
28
  end
@@ -1,3 +1,3 @@
1
1
  module Ximate
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ximate
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.0
5
+ version: 0.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Enrico Pilotto
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-13 00:00:00 +02:00
13
+ date: 2011-06-08 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies: []
16
16