<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>MIT-LICENSE</filename>
    </added>
    <added>
      <filename>README.rdoc</filename>
    </added>
    <added>
      <filename>app/models/user_group.rb</filename>
    </added>
    <added>
      <filename>app/views/orders/_orders.erb</filename>
    </added>
    <added>
      <filename>app/views/orders/index.html.erb</filename>
    </added>
    <added>
      <filename>app/views/orders/index.js.rjs</filename>
    </added>
    <added>
      <filename>db/migrate/20080906191540_create_user_groups.rb</filename>
    </added>
    <added>
      <filename>db/migrate/20080906191555_users_to_user_groups.rb</filename>
    </added>
    <added>
      <filename>db/migrate/20080906205538_create_sessions.rb</filename>
    </added>
    <added>
      <filename>test/fixtures/user_groups.yml</filename>
    </added>
    <added>
      <filename>test/unit/user_group_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -6,7 +6,7 @@ class ApplicationController &lt; ActionController::Base
 
   # See ActionController::RequestForgeryProtection for details
   # Uncomment the :secret if you're not using the cookie session store
-  protect_from_forgery # :secret =&gt; 'e619585c1ea01344f19d504e61dd6e3d'
+  #protect_from_forgery # :secret =&gt; 'e619585c1ea01344f19d504e61dd6e3d'
   
   # See ActionController::Base for details 
   # Uncomment this to filter the contents of submitted sensitive data parameters</diff>
      <filename>app/controllers/application.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,7 @@
 class OrdersController &lt; ApplicationController
   def index
-    # This creates a new search object to search for users. It's safe to pass params into here because
-    # new_search and new_conditions are protected, meaning the structure of the params hash is run through
-    # checks to ensure there is no SQL injection or anything invalid. This ultimately allows you to create a controllers action
-    # that searches, orders, and paginates in 2 lines.
-    @search = User.new_search(params[:search])
-    
-    # .all takes pagination into account. .count tells you how many records will be returned disregarding the limit and offset options.
-    @users, @users_count = @search.all, @search.count
+    # Please see users_controller.rb for comments and information on this code.
+    @search = Order.new_search(params[:search])
+    @orders, @orders_count = @search.all, @search.count
   end
 end
\ No newline at end of file</diff>
      <filename>app/controllers/orders_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,8 +7,9 @@ class UsersController &lt; ApplicationController
     #
     # This also gives people using your site as a service some real flexibility when it comes to searching. The sky is the limit on how they want to search, unless you restrict them.
     # Restricting conditions works similar to ActiveRecord's attr_protected and attr_accessible.  See the documentation for more details.
+        
     @search = User.new_search(params[:search])
-    
+        
     # .all takes pagination into account. .count tells you how many records will be returned disregarding the limit and offset options.
     @users, @users_count = @search.all, @search.count
   end</diff>
      <filename>app/controllers/users_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,4 @@
 class User &lt; ActiveRecord::Base
+  belongs_to :user_group
   has_many :orders
 end</diff>
      <filename>app/models/user.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,6 +5,23 @@
     &lt;%= calendar_date_select_includes %&gt;
 &lt;/head&gt;
 &lt;body&gt;
+    &lt;h1 style=&quot;font-size: 1.5em&quot;&gt;Searchgasm example&lt;/h1&gt;
+    This is a simple / plain example of how to implement Searchgasm into a rails application. As you can see it supports searching, ordering, and pagination all in one plugin. Here are some helpful links:&lt;br /&gt;
+    &lt;br /&gt;
+    &lt;strong&gt;&lt;a href=&quot;http://github.com/binarylogic/searchgasm_example&quot;&gt;Source code for this example&lt;/a&gt;&amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;Tutorial on this example&amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://github.com/binarylogic/searchgasm&quot;&gt;Searchgasm source / repository&lt;/a&gt;&amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://searchgasm.rubyforge.org&quot;&gt;Searchgasm documentation&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;
+    &lt;br /&gt;
+    &lt;% if controller_name == &quot;users&quot; %&gt;
+        Non AJAX Example
+    &lt;% else %&gt;
+        &lt;%= link_to &quot;Non AJAX example&quot;, users_path %&gt;
+    &lt;% end %&gt;
+    &amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;
+    &lt;% if controller_name == &quot;orders&quot; %&gt;
+        AJAX Example
+    &lt;% else %&gt;
+        &lt;%= link_to &quot;AJAX example&quot;, orders_path %&gt;
+    &lt;% end %&gt;&lt;br /&gt;
+    &lt;br /&gt;
     &lt;%= yield %&gt;
 &lt;/body&gt;
 &lt;/html&gt;
\ No newline at end of file</diff>
      <filename>app/views/layouts/application.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -2,35 +2,50 @@
 You can pass your search object right into form_for or remote_form_for and it will do the rest. Just like passing an ActiveRecord attribute. Use it the same way:
 
 Need to scope the search? form_for([@current_user, @search])
+Need to namespace the search? form_for([:admin, @search])
 Want to specify your own url? form_for(@search, :url =&gt; whatever_path)
 Need to specify your own name? form_for(:whatever, @search)
 
-The beauty of this is that it recoginizes that its a search object and helps you out. It adds 3 hidden fields for you:
+The beauty of this is that it recognizes that its a search object and helps you out. It adds 3 hidden fields for you:
 
 1. order_by
 2. order_as
 2. per_page
 
-This way when people start a new search those 3 things will be &quot;remembered&quot; and the results will be displayed in that manner.
+This way when people start a new search those 3 things will be &quot;remembered&quot; and the results will be displayed in that manner. If you don't want to include these simply do:
+
+form_for(@search, :hidden_fields =&gt; [])
+
+or
+
+form_for(@search, :hidden_fields =&gt; :per_page) for only the per_page option
+
+or
+
+form_for(@search, :hidden_fields =&gt; [:order_by, :order_as]) for only the order_by and order_as options
+
+For more information please see Searchgasmm::Helpers::FormHelper
 --&gt;
+
 &lt;% form_for @search do |f| %&gt;
     &lt;fieldset&gt;
-        &lt;legend&gt;Search&lt;/legend&gt;
+        &lt;legend&gt;Search Users&lt;/legend&gt;
         
         &lt;% f.fields_for @search.conditions do |users| %&gt;
             &lt;!--
             You can specify ANY of the conditions available on ANY of the attributes. Adding a condition and having it be a part
             of the search is as simple as adding another form element.
             --&gt;
-            First name:&lt;br /&gt;
+            First name keywords:&lt;br /&gt;
             &lt;%= users.text_field :first_name_keywords %&gt;&lt;br /&gt;
             &lt;br /&gt;
             
+            &lt;!-- This is a custom condition, checkout config/initializers/searchgasm.rb --&gt;
             First name sounds like: (try &amp;quot;bin&amp;quot;, this is a custom condition, checkout config/initializers/searchgasm.rb)&lt;br /&gt;
             &lt;%= users.text_field :first_name_sounds_like %&gt;&lt;br /&gt;
             &lt;br /&gt;
             
-            Last name:&lt;br /&gt;
+            Last name keywords:&lt;br /&gt;
             &lt;%= users.text_field :last_name_keywords %&gt;&lt;br /&gt;
             &lt;br /&gt;
             
@@ -56,6 +71,12 @@ This way when people start a new search those 3 things will be &quot;remembered&quot; and
                 $&lt;%= orders.text_field :total_gt %&gt;&lt;br /&gt;
                 &lt;br /&gt;
             &lt;% end %&gt;
+            
+            &lt;% users.fields_for users.object.user_group do |user_group| %&gt;
+                Belongs to user group with name that starts with:&lt;br /&gt;
+                &lt;%= user_group.text_field :name_starts_with %&gt;&lt;br /&gt;
+                &lt;br /&gt;
+            &lt;% end %&gt;
             &lt;%= f.submit &quot;Search&quot; %&gt;
         &lt;% end %&gt;
     &lt;/fieldset&gt;
@@ -63,23 +84,42 @@ This way when people start a new search those 3 things will be &quot;remembered&quot; and
 
 &lt;% if @users_count &gt; 0 %&gt;
     &lt;%= @users_count %&gt; users found
-    &lt;table&gt;
+    &lt;table border=&quot;1&quot; cellpadding=&quot;5&quot;&gt;
         &lt;tr&gt;
             &lt;!--
-            order_by allows you to create a link to order the data by that coloumn. You aren't limited to the local columns. Since users belong to user groups we could do
+            order_by allows you to create a link to order the data by that coloumn. You aren't limited to the local columns. If users belonged to user groups we could do:
             
             order_by(:user_group =&gt; :name)
             
-            You can traverse through your relationships to define how things are ordered. There are a lot of options for this to allow you to customize it to your liking. Please
-            glance at the Searchgasm::Helpers module for a list of options.
+            If user groups belongs to accounts we could do:
+            
+            order_by(:user_group =&gt; {:account =&gt; :name})
+            
+            You can traverse through your relationships to define how things are ordered.
+            
+            All that order_by does is create a bunch of options and then spit it out as a link. If for some reason you don't want it to output a link you can pass it a block and do anything you want:
+            
+            &lt;%= order_by(:id) { |options| link_to(options[:text], options[:url]) } %&gt;
+            
+            or
+            
+            &lt;% order_by(:id) do |options| %&gt;&lt;%= link_to(options[:text], options[:url]) %&gt;&lt;% end %&gt;
+            
+            The options variable passes back the same options you are allowed to input, but with values.
+            
+            There are a lot of options for this to allow you to customize it to your liking. Please
+            glance at the Searchgasm::Helpers::SearchHelper module for a list of options.
             --&gt;
             &lt;th&gt;&lt;%= order_by :id %&gt;&lt;/th&gt;
-            &lt;th&gt;&lt;%= order_by :first_name %&gt;&lt;/th&gt;
-            &lt;th&gt;&lt;%= order_by :last_name %&gt;&lt;/th&gt;
-            &lt;th&gt;&lt;%= order_by :email %&gt;&lt;/th&gt;
+            &lt;th&gt;&lt;%= order_by :user_group =&gt; :name %&gt;&lt;/th&gt; &lt;!-- order user_groups.name ASC --&gt;
+            &lt;th&gt;&lt;% order_by(:first_name) do |options| %&gt;&lt;%= link_to(options[:text], options[:url]) %&gt;&lt;% end %&gt;&lt;/th&gt;
+            &lt;th&gt;&lt;%= order_by(:last_name) { |options| link_to(options[:text], options[:url]) } %&gt;&lt;/th&gt;
+            &lt;th&gt;&lt;%= order_by [:email, :first_name] %&gt;&lt;/th&gt; &lt;!-- order email ASC, first_name ASC --&gt;
+        &lt;/tr&gt;
         &lt;% @users.each do |user| %&gt;
             &lt;tr&gt;
                 &lt;td&gt;&lt;%= user.id %&gt;&lt;/td&gt;
+                &lt;td&gt;&lt;%= user.user_group ? user.user_group.name : &quot;-&quot; %&gt;&lt;/td&gt;
                 &lt;td&gt;&lt;%= user.first_name %&gt;&lt;/td&gt;
                 &lt;td&gt;&lt;%= user.last_name %&gt;&lt;/td&gt;
                 &lt;td&gt;&lt;%= user.email %&gt;&lt;/td&gt;
@@ -90,12 +130,12 @@ This way when people start a new search those 3 things will be &quot;remembered&quot; and
     &lt;br /&gt;
     &lt;br /&gt;
     &lt;!--
-    Per page returns a select with the different options. This is very customizable, you can change just about anything. Please take a look at the Searchgasm::Helpers documentation for options
+    Per page returns a select with the different options. You can return links by passing :type =&gt; :links option, or just like order by, you can pass it a block and it will spit out the result of the block. This is very customizable, you can do anything you want with this. Please take a look at the Searchgasm::Helpers::SearchHelper documentation for options
     --&gt;
     Per page: &lt;%= per_page %&gt;
 
     &lt;!--
-    Page returns a drop down with the page options. You can change this from a drop down to a links. It's completely customizable. Please take a look at the Searchgasm::Helpers documentation for options
+    Page returns a drop down with the page options. You can return a flickr like navigation by passing :type =&gt; :links option, or just like order by, you can pass it a block and it will spit out the result of the block. It's completely customizable. Please take a look at the Searchgasm::Helpers::SearchHelper documentation for options
     --&gt;
     &lt;% if @search.page_count &gt; 1 %&gt;
         &lt;br /&gt;</diff>
      <filename>app/views/users/index.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -50,15 +50,15 @@ Rails::Initializer.run do |config|
   # If you change this key, all old sessions will become invalid!
   # Make sure the secret is at least 30 characters and all random, 
   # no regular words or you'll be exposed to dictionary attacks.
-  config.action_controller.session = {
-    :session_key =&gt; '_searchgasm_example_session',
-    :secret      =&gt; '4d7db02f53d3bccd73428357072797fb6b04507ad3ef08f0abc589c2f1a6ee8f10e71bdbbc357f8fd50a7620f4bb433836e18017517a9df9df70c910fa3006c8'
-  }
+  #config.action_controller.session = {
+  #  :session_key =&gt; '_searchgasm_example_session',
+  #  :secret      =&gt; '4d7db02f53d3bccd73428357072797fb6b04507ad3ef08f0abc589c2f1a6ee8f10e71bdbbc357f8fd50a7620f4bb433836e18017517a9df9df70c910fa3006c8'
+  #}
 
   # Use the database for sessions instead of the cookie-based default,
   # which shouldn't be used to store highly confidential information
   # (create the session table with &quot;rake db:sessions:create&quot;)
-  # config.action_controller.session_store = :active_record_store
+  config.action_controller.session_store = :active_record_store
 
   # Use SQL instead of Active Record's schema dumper when creating the test database.
   # This is necessary if your schema can't be completely dumped by the schema dumper,</diff>
      <filename>config/environment.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>README</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>dff13c816498d695040eb20bf737aa9ce17d5ac5</id>
    </parent>
  </parents>
  <author>
    <name>Ben Johnson</name>
    <email>bjohnson@binarylogic.com</email>
  </author>
  <url>http://github.com/binarylogic/searchlogic_example/commit/afb04fd9d32e04fb6f6e71e37ebd4da5554f983e</url>
  <id>afb04fd9d32e04fb6f6e71e37ebd4da5554f983e</id>
  <committed-date>2008-09-06T18:49:49-07:00</committed-date>
  <authored-date>2008-09-06T18:49:49-07:00</authored-date>
  <message>Completed example</message>
  <tree>867242222e0b00a9a1f2d7e206045beb905ab156</tree>
  <committer>
    <name>Ben Johnson</name>
    <email>bjohnson@binarylogic.com</email>
  </committer>
</commit>
