searchlogic 2.4.15 → 2.4.16

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -2,4 +2,4 @@
2
2
  :major: 2
3
3
  :build:
4
4
  :minor: 4
5
- :patch: 15
5
+ :patch: 16
@@ -97,6 +97,11 @@ module Searchlogic
97
97
  self
98
98
  end
99
99
 
100
+ # Returns the column we are currently ordering by
101
+ def ordering_by
102
+ order && order.gsub(/^(ascend|descend)_by_/, '')
103
+ end
104
+
100
105
  private
101
106
  def method_missing(name, *args, &block)
102
107
  condition_name = condition_name(name)
data/searchlogic.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{searchlogic}
8
- s.version = "2.4.15"
8
+ s.version = "2.4.16"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ben Johnson of Binary Logic"]
@@ -335,6 +335,23 @@ describe Searchlogic::Search do
335
335
  end
336
336
  end
337
337
 
338
+ context "#ordering_by" do
339
+ it "should return nil if we aren't ordering" do
340
+ search = User.search
341
+ search.ordering_by.should be_nil
342
+ end
343
+
344
+ it "should return the column name for ascending" do
345
+ search = User.search(:order => "ascend_by_first_name")
346
+ search.ordering_by.should == "first_name"
347
+ end
348
+
349
+ it "should return the column name for descending" do
350
+ search = User.search(:order => "descend_by_first_name")
351
+ search.ordering_by.should == "first_name"
352
+ end
353
+ end
354
+
338
355
  context "#method_missing" do
339
356
  context "setting" do
340
357
  it "should call named scopes for conditions" do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 2
7
7
  - 4
8
- - 15
9
- version: 2.4.15
8
+ - 16
9
+ version: 2.4.16
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ben Johnson of Binary Logic