<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,8 @@
+== 1.2.1 released 2008-09-24
+
+* Fixed problem when determining if an order_by_link is currently being ordered. Just &quot;stringified&quot; both comparable values.
+* Removed default order_by and order_as. They will ONLY have values if you specify how to order, otherwise they are nil.
+
 == 1.2.0 released 2008-09-24
 
 * Added searchgasm_params and searchgasm_url helper to use outside of the control type helpers.</diff>
      <filename>CHANGELOG.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -38,7 +38,7 @@ lib/searchgasm/search/conditions.rb
 lib/searchgasm/search/ordering.rb
 lib/searchgasm/search/pagination.rb
 lib/searchgasm/search/protection.rb
-lib/searchgasm/shared/searching.rb
+lib/searchgasm/search/searching.rb
 lib/searchgasm/shared/utilities.rb
 lib/searchgasm/shared/virtual_classes.rb
 lib/searchgasm/version.rb
@@ -49,6 +49,7 @@ Rakefile
 README.rdoc
 test/fixtures/accounts.yml
 test/fixtures/orders.yml
+test/fixtures/user_groups.yml
 test/fixtures/users.yml
 test/libs/acts_as_tree.rb
 test/libs/rexml_fix.rb
@@ -65,4 +66,3 @@ test/test_search_conditions.rb
 test/test_search_ordering.rb
 test/test_search_pagination.rb
 test/test_search_protection.rb
-test/text_config.rb</diff>
      <filename>Manifest</filename>
    </modified>
    <modified>
      <diff>@@ -190,7 +190,7 @@ module Searchgasm
             options[:text] ||= determine_order_by_text(order_by)
             options[:asc_indicator] ||= Config.asc_indicator
             options[:desc_indicator] ||= Config.desc_indicator
-            options[:text] += options[:search_obj].desc? ? options[:desc_indicator] : options[:asc_indicator] if options[:search_obj].order_by == order_by
+            options[:text] += options[:search_obj].desc? ? options[:desc_indicator] : options[:asc_indicator] if deep_stringify(options[:search_obj].order_by) == order_by
             options[:url] = searchgasm_params(options.merge(:search_params =&gt; {:order_by =&gt; order_by}))
             options
           end
@@ -234,13 +234,15 @@ module Searchgasm
             when String
               obj
             when Symbol
-              obj = obj.to_s
+              obj.to_s
             when Array
-              obj = obj.collect { |item| deep_stringify(item) }
+              obj.collect { |item| deep_stringify(item) }
             when Hash
               new_obj = {}
               obj.each { |key, value| new_obj[key.to_s] = deep_stringify(value) }
               new_obj
+            else
+              obj
             end
           end
       end</diff>
      <filename>lib/searchgasm/helpers/control_types/link.rb</filename>
    </modified>
    <modified>
      <diff>@@ -37,58 +37,52 @@ module Searchgasm
       
       # Convenience method for determining if the ordering is ascending
       def asc?
+        return false if order_as.nil?
         !desc?
       end
       
       # Convenience method for determining if the ordering is descending
       def desc?
+        return false if order_as.nil?
         order_as == &quot;DESC&quot;
       end
       
       # Determines how the search is being ordered: as DESC or ASC
       def order_as
-        @order_as ||= (order.blank? || order =~ /ASC$/i) ? &quot;ASC&quot; : &quot;DESC&quot;
+        return if order.blank?
+        @order_as ||= order =~ /ASC$/i ? &quot;ASC&quot; : &quot;DESC&quot;
       end
       
       # Sets how the results will be ordered: ASC or DESC
       def order_as=(value)
         value = value.to_s.upcase
         raise(ArgumentError, &quot;order_as only accepts a string as ASC or DESC&quot;) unless [&quot;ASC&quot;, &quot;DESC&quot;].include?(value)
-        
-        if order.blank?
-          @order = order_by_to_order(order_by, value)
-        else
-          @order.gsub!(/(ASC|DESC)/i, value)
-        end
-        
+        @order.gsub!(/(ASC|DESC)/i, value) if !order.blank?
         @order_as = value
       end
       
       # Determines by what columns the search is being ordered. This is nifty in that is reverse engineers the order SQL to determine this, only
       # if you haven't explicitly set the order_by option yourself.
       def order_by
+        return if order.blank?
         return @order_by if @order_by
         
-        if !order.blank?
-          # Reversege engineer order, only go 1 level deep with relationships, anything beyond that is probably excessive and not good for performance
-          order_parts = order.split(&quot;,&quot;).collect do |part|
-            part.strip!
-            part.gsub!(/ (ASC|DESC)$/i, &quot;&quot;).gsub!(/(.*)\./, &quot;&quot;)
-            table_name = ($1 ? $1.gsub(/[^a-z0-9_]/i, &quot;&quot;) : nil)
-            part.gsub!(/[^a-z0-9_]/i, &quot;&quot;)
-            reflection = nil
-            if table_name &amp;&amp; table_name != klass.table_name
-              reflection = klass.reflect_on_association(table_name.to_sym) || klass.reflect_on_association(table_name.singularize.to_sym)
-              next unless reflection
-              {reflection.name.to_s =&gt; part}
-            else
-              part
-            end
-          end.compact
-          @order_by = order_parts.size &lt;= 1 ? order_parts.first : order_parts
-        else
-          @order_by = klass.primary_key
-        end
+        # Reversege engineer order, only go 1 level deep with relationships, anything beyond that is probably excessive and not good for performance
+        order_parts = order.split(&quot;,&quot;).collect do |part|
+          part.strip!
+          part.gsub!(/ (ASC|DESC)$/i, &quot;&quot;).gsub!(/(.*)\./, &quot;&quot;)
+          table_name = ($1 ? $1.gsub(/[^a-z0-9_]/i, &quot;&quot;) : nil)
+          part.gsub!(/[^a-z0-9_]/i, &quot;&quot;)
+          reflection = nil
+          if table_name &amp;&amp; table_name != klass.table_name
+            reflection = klass.reflect_on_association(table_name.to_sym) || klass.reflect_on_association(table_name.singularize.to_sym)
+            next unless reflection
+            {reflection.name.to_s =&gt; part}
+          else
+            part
+          end
+        end.compact
+        @order_by = order_parts.size &lt;= 1 ? order_parts.first : order_parts
       end
       
       # Lets you set how to order the data
@@ -104,7 +98,7 @@ module Searchgasm
         self.order_by_auto_joins.clear
         @memoized_auto_joins = nil
         @order_by = get_order_by_value(value)
-        @order = order_by_to_order(@order_by, order_as)
+        @order = order_by_to_order(@order_by, @order_as || &quot;ASC&quot;)
         @order_by
       end
       </diff>
      <filename>lib/searchgasm/search/ordering.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,13 +4,20 @@ class TestSearchOrdering &lt; Test::Unit::TestCase
   def test_order_as
     search = Account.new_search
     assert_equal nil, search.order
-    assert_equal &quot;ASC&quot;, search.order_as
-    assert search.asc?
+    assert_equal nil, search.order_as
+    assert !search.asc?
     
     search.order_as = &quot;DESC&quot;
-    assert_equal &quot;DESC&quot;, search.order_as
-    assert search.desc?
-    assert_equal &quot;\&quot;accounts\&quot;.\&quot;id\&quot; DESC&quot;, search.order
+    assert_equal nil, search.order_as
+    assert !search.desc?
+    assert_equal nil, search.order
+    
+    search.order_by = &quot;name&quot;
+    assert_equal &quot;\&quot;accounts\&quot;.\&quot;name\&quot; DESC&quot;, search.order
+    
+    search.order_as = &quot;ASC&quot;
+    assert_equal &quot;\&quot;accounts\&quot;.\&quot;name\&quot; ASC&quot;, search.order
+    assert search.asc?
     
     search.order = &quot;id ASC&quot;
     assert_equal &quot;ASC&quot;, search.order_as
@@ -31,7 +38,7 @@ class TestSearchOrdering &lt; Test::Unit::TestCase
   def test_order_by
     search = Account.new_search
     assert_equal nil, search.order
-    assert_equal &quot;id&quot;, search.order_by
+    assert_equal nil, search.order_by
     
     search.order_by = &quot;first_name&quot;
     assert_equal &quot;first_name&quot;, search.order_by</diff>
      <filename>test/test_search_ordering.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6a8e5f76a1bb3ff2ffdb4405e0eb72db063f3117</id>
    </parent>
  </parents>
  <author>
    <name>binarylogic</name>
    <email>bjohnson@binarylogic.com</email>
  </author>
  <url>http://github.com/binarylogic/searchlogic/commit/758b6d076210fa85b67aef903cd7cfe33d3575a2</url>
  <id>758b6d076210fa85b67aef903cd7cfe33d3575a2</id>
  <committed-date>2008-09-25T09:59:26-07:00</committed-date>
  <authored-date>2008-09-25T09:59:26-07:00</authored-date>
  <message>Removed default order_by and order_as</message>
  <tree>e8e207494029779ca68074fdd8f65b885b61745f</tree>
  <committer>
    <name>binarylogic</name>
    <email>bjohnson@binarylogic.com</email>
  </committer>
</commit>
