sort_it_out 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Histroy.txt +10 -0
- data/VERSION +1 -1
- data/lib/sort_it_out.rb +1 -1
- data/lib/sort_it_out/sortable.rb +7 -1
- data/sort_it_out.gemspec +1 -1
- metadata +1 -1
data/Histroy.txt
CHANGED
@@ -1,4 +1,14 @@
|
|
1
|
+
= 0.9.2 2009-11-15
|
2
|
+
|
3
|
+
* Added ability yo specify default sort as a string that is a SQL fragment.
|
4
|
+
|
5
|
+
|
1
6
|
= 0.9.1 2009-11-15
|
2
7
|
|
8
|
+
* Fixed bug when there is no mapping specified for sortable.
|
9
|
+
|
10
|
+
|
11
|
+
= 0.9.0 2009-11-15
|
12
|
+
|
3
13
|
* Ported from a lib in a project to this Gem.
|
4
14
|
* No tests yet.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.2
|
data/lib/sort_it_out.rb
CHANGED
data/lib/sort_it_out/sortable.rb
CHANGED
@@ -30,7 +30,13 @@ module SortItOut
|
|
30
30
|
def resolve_order_clause( order, dir="ASC" )
|
31
31
|
translated = self.options[:map][order.to_sym] unless self.options[:map].nil?
|
32
32
|
order = translated unless translated.nil?
|
33
|
-
|
33
|
+
if order.is_a?( Array )
|
34
|
+
return order.map { |field| "#{field} #{dir}" }.join( ", " )
|
35
|
+
elsif order.is_a?( String ) && (order.include?( "," ) || order.include?( "ASC") || order.include?( "DESC" ))
|
36
|
+
return order
|
37
|
+
else order.is_a?( Symbol )
|
38
|
+
return "#{order.to_s} #{dir}"
|
39
|
+
end
|
34
40
|
end
|
35
41
|
end
|
36
42
|
|
data/sort_it_out.gemspec
CHANGED