<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -149,7 +149,7 @@ module ActiveScaffold::DataStructures
     end
     
     def extract_direction(direction_part)
-      if direction_part.upcase == 'DESC'
+      if direction_part.to_s.upcase == 'DESC'
         'DESC'
       else
         'ASC'</diff>
      <filename>lib/active_scaffold/data_structures/sorting.rb</filename>
    </modified>
    <modified>
      <diff>@@ -103,10 +103,20 @@ class SortingTest &lt; Test::Unit::TestCase
     assert_equal 'model_stubs.a DESC, model_stubs.b ASC', @sorting.clause
   end
   
-  ModelStubWithDefaultScope = ModelStub.clone
-  ModelStubWithDefaultScope.class_eval { default_scope :order =&gt; 'a DESC, players.last_name ASC' }
-  def test_set_default_sorting_with_default_scope
-    @sorting.set_default_sorting ModelStubWithDefaultScope
+  def test_set_default_sorting_with_simple_default_scope
+    model_stub_with_default_scope = ModelStub.clone
+    model_stub_with_default_scope.class_eval { default_scope :order =&gt; 'a' }
+    @sorting.set_default_sorting model_stub_with_default_scope
+    
+    assert @sorting.sorts_on?(:a)
+    assert_equal 'ASC', @sorting.direction_of(:a)
+    assert_nil @sorting.clause
+  end
+
+  def test_set_default_sorting_with_complex_default_scope
+    model_stub_with_default_scope = ModelStub.clone
+    model_stub_with_default_scope.class_eval { default_scope :order =&gt; 'a DESC, players.last_name ASC' }
+    @sorting.set_default_sorting model_stub_with_default_scope
     
     assert @sorting.sorts_on?(:a)
     assert_equal 'DESC', @sorting.direction_of(:a)</diff>
      <filename>test/data_structures/sorting_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,7 +10,12 @@ TextFieldWithExample.prototype = {
 		this.defaultText = defaultText;
 		this.createHiddenInput();
 
+		if (options.focus) this.input.focus();
 		this.checkAndShowExample();
+		if (options.focus) {
+			this.input.selectionStart = 0;
+			this.input.selectionEnd = 0;
+		}
 
 		Event.observe(this.input, &quot;blur&quot;, this.onBlur.bindAsEventListener(this));
 		Event.observe(this.input, &quot;focus&quot;, this.onFocus.bindAsEventListener(this));
@@ -39,9 +44,7 @@ TextFieldWithExample.prototype = {
 		this.checkAndShowExample();
 	},
 	onFocus: function(event) {
-		if (this.exampleShown()) {
-		    this.removeExample();
-	  	}
+		this.removeExample();
 	},
 	onClick: function(event) {
 		this.removeExample();
@@ -57,7 +60,7 @@ TextFieldWithExample.prototype = {
 			Element.addClassName(this.input, this.options.exampleClassName);
 		}
 	},
-  removeExample: function() {
+	removeExample: function() {
 		if (this.exampleShown()) {
 			this.input.value = '';
 			this.input.name = this.name;</diff>
      <filename>test/mock_app/public/javascripts/active_scaffold/default/form_enhancements.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>57024eb4764ff811b12e7ac16fff90cc5d4d5326</id>
    </parent>
  </parents>
  <author>
    <name>Sergio</name>
    <email>sergio@entrecables.com</email>
  </author>
  <url>http://github.com/activescaffold/active_scaffold/commit/68bd3718561d791fb37d0b6aab65a72713125688</url>
  <id>68bd3718561d791fb37d0b6aab65a72713125688</id>
  <committed-date>2009-10-28T05:45:54-07:00</committed-date>
  <authored-date>2009-10-28T05:45:54-07:00</authored-date>
  <message>Fix set sorting from default_scope when direction is not set</message>
  <tree>032e568c8402eea88322a7ff7722f573e6a19c6e</tree>
  <committer>
    <name>Sergio</name>
    <email>sergio@entrecables.com</email>
  </committer>
</commit>
