ximate 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ximate/activerecord/relation.rb +10 -6
- data/lib/ximate/version.rb +1 -1
- metadata +2 -2
@@ -13,12 +13,16 @@ module ActiveRecord
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def order(*args)
|
16
|
-
if
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
data/lib/ximate/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: ximate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
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-
|
13
|
+
date: 2011-06-08 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|