Permalink
Browse files

Release v1.0.1 (see changelog)

  • Loading branch information...
binarylogic committed Sep 11, 2008
1 parent 6ad1526 commit 4c13dd081abbde1d202a6014ec0bcb6f3fb462d0
View
@@ -1,23 +0,0 @@
-v1.0.0. Major changes in the helpers, they were completely re-engineered. Much nicer and cleaner now. I established a pattern between all helpers giving you complete flexibility as to how they are used. All helpers are called differently now (see documentation).
-
-v0.9.10. Hardened more tests, fixed bug with setting the per_page configuration to only take effect on protected searches, thus staying out of the way of normal searching.
-
-v0.9.9. Fixed setting per_page to nil, false, or ''. This is done to "show all" results.
-
-v0.9.8. Fixed order_by helper bug when determing the text with arrays. Should use the first value instead of last. Added in per_page config option.
-
-v0.9.7. Complete class restructure, much more organized, added in documentation, added in helpers for using searchgasm in a rails app, updated readme with link to documentation as well as a live example, some bug fixes, more tests
-
-v0.9.6. Fixed bug when instantiating with nil options
-
-v0.9.5. Enhanced searching with conditions only. Updated read me to include example on adding your own conditions.
-
-v0.9.4. Cleaned up search methods, removed reset! method for base and conditions.
-
-v0.9.3. Changed structure of conditions to have their own class. Making it easier to add your own conditions.
-
-v0.9.2. Enhanced protection
-
-v0.9.1. Added aliases for datetime, date, time, and timestamp attrs. You could call created_at_after, mow you can also call created_after.
-
-v0.9.0. First release
View
@@ -0,0 +1,64 @@
+== 1.0.1 released 2008-09-08
+
+* Cached "searchers" so when a new search object is instantiated it doesn't go through all of the meta programming and method creation. Helps a lot with performance. You will see the speed benefits after the first instantiation.
+* Added in new options for page_links.
+* Fixed minor bugs when doing page_links.
+* Updated documentation to be more detailed and inclusive.
+
+== 1.0.0 released 2008-09-08
+
+* Major changes in the helpers, they were completely re-engineered. Hence the new version. I established a pattern between all helpers giving you complete flexibility as to how they are used. All helpers are called differently now (see documentation).
+
+== 0.9.10 released 2008-09-08
+
+* Fixed bug with setting the per_page configuration to only take effect on protected searches, thus staying out of the way of normal searching.
+* Hardened more tests
+
+== 0.9.9 released 2008-09-07
+
+* Fixed setting per_page to nil, false, or ''. This is done to "show all" results.
+
+== 0.9.8 released 2008-09-06
+
+* Fixed order_by helper bug when guessing the text with arrays. Should use the first value instead of last.
+* Added in per_page config option.
+
+== 0.9.7 released 2008-09-06
+
+* Complete class restructure. Moved the 3 main components into their own base level class: Search, Conditions, Condition
+* Split logic and functionality into their own modules, implemented via alias_chain_method
+* Added in helpers for using in a rails app
+* Added link to documentation and live example in README
+* Various small bug fixes
+* Hardened tests
+
+== 0.9.6 released 2008-09-04
+
+* Fixed bug when instantiating with nil options
+
+== 0.9.5 released 2008-09-03
+
+* Enhanced searching with conditions only, added in search methods and calculations
+* Updated README to include examples
+
+== 0.9.4 released 2008-09-03
+
+* Cleaned up search methods
+* Removed reset!method for both searching and searching by conditions
+
+== 0.9.3 released 2008-09-02
+
+* Changed structure of conditions to have their own class
+* Added API for adding your own conditions.
+
+== 0.9.2 released 2008-09-02
+
+* Enhanced protection from SQL injections (made more efficient)
+
+== 0.9.1 released 2008-09-02
+
+* Added aliases for datetime, date, time, and timestamp attrs. You could call created_at_after, now you can also call created_after. Just removed the "at" requirement.
+
+== 0.9.0 released 2008-09-01
+
+* First release
View
@@ -1,8 +1,9 @@
-CHANGELOG
+CHANGELOG.rdoc
examples/README.rdoc
init.rb
lib/searchgasm/active_record/associations.rb
lib/searchgasm/active_record/base.rb
+lib/searchgasm/active_record.rb
lib/searchgasm/condition/base.rb
lib/searchgasm/condition/begins_with.rb
lib/searchgasm/condition/child_of.rb
@@ -22,6 +23,7 @@ lib/searchgasm/condition/tree.rb
lib/searchgasm/conditions/base.rb
lib/searchgasm/conditions/protection.rb
lib/searchgasm/config.rb
+lib/searchgasm/core_ext/hash.rb
lib/searchgasm/helpers/control_types/link.rb
lib/searchgasm/helpers/control_types/links.rb
lib/searchgasm/helpers/control_types/remote_link.rb
View
@@ -8,7 +8,7 @@ Searchgasm is orgasmic. Maybe not orgasmic, but you will get aroused. So go grab
* <b>Documentation:</b> http://searchgasm.rubyforge.org
* <b>Easy pagination, ordering, and searching tutorial:</b> http://www.binarylogic.com/2008/9/7/tutorial-pagination-ordering-and-searching-with-searchgasm
-* <b>The tutorial above, live:</b> http://searchgasm_example.binarylogic.com
+* <b>Live example of the tutorial above (with source):</b> http://searchgasm_example.binarylogic.com
== Install and use
@@ -67,8 +67,8 @@ Now your view. Things to note in this view:
1. Passing a search object right into form\_for and fields\_for
2. The built in conditions for each column and how you can traverse the relationships and set conditions on them
-3. The order_by helper
-4. The page and per_page helpers
+3. The order_by_link helper
+4. The page_select and per_page_select helpers
5. All of your search logic is in 1 spot: your view. Nice and DRY.
Your view:
@@ -82,25 +82,28 @@ Your view:
= orders.select :total_gt, (1..100)
= f.submit "Search"
- %table
- %tr
- %th= order_by_link :account => :name
- %th= order_by_link :first_name
- %th= order_by_link :last_name
- %th= order_by_link :email
- - @users.each do |user|
+ - if @users_count > 0
+ %table
+ %tr
+ %th= order_by_link :account => :name
+ %th= order_by_link :first_name
+ %th= order_by_link :last_name
+ %th= order_by_link :email
+ - @users.each do |user|
%tr
%td= user.account? ? user.account.name : "-"
%td= user.first_name
%td= user.last_name
%td= user.email
- Per page:
- = per_page_select
- Page:
- = page_select
+ Per page:
+ = per_page_select
+ Page:
+ = page_select
+ - else
+ No users were found.
-<b>{See my tutorial on this example}(http://www.binarylogic.com/2008/9/7/tutorial-pagination-ordering-and-searching-with-searchgasm)</b>
+<b>See my tutorial on this example: http://www.binarylogic.com/2008/9/7/tutorial-pagination-ordering-and-searching-with-searchgasm</b>
== Exhaustive Example w/ Object Based Searching (great for form_for or fields_for)
@@ -174,13 +177,6 @@ Any of the options used in the above example can be used in these, but for the s
search.per_page = 20
search.all
-If you want to use Searchgasm directly:
-
- search = Searchgasm::Search::Base.new(User, :conditions => {:age_gt => 18})
- search.conditions.first_name_contains = "Ben"
- search.per_page = 20
- search.all
-
== Search with conditions only
Don't need pagination, ordering, or any of the other options? Search with conditions only.
@@ -194,19 +190,13 @@ Pass a conditions object right into ActiveRecord:
User.all(:conditions => conditions)
-Again, if you want to use Searchgasm directly:
-
- conditions = Searchgasm::Conditions::Base.new(User, :age_gt => 18)
- conditions.first_name_contains = "Ben"
- conditions.all
-
== Scoped searching
@current_user.orders.find(:all, :conditions => {:total_lte => 500})
@current_user.orders.count(:conditions => {:total_lte => 500})
@current_user.orders.sum('total', :conditions => {:total_lte => 500})
- search = @current_user.orders.build_search('total', :conditions => {:total_lte => 500})
+ search = @current_user.orders.build_search(:conditions => {:total_lte => 500})
== Searching trees
View
@@ -1,6 +1,9 @@
require "active_record"
require "active_support"
+# Core Ext
+require "searchgasm/core_ext/hash"
+
# Utilties
require "searchgasm/version"
require "searchgasm/config"
@@ -0,0 +1,8 @@
+module Searchgasm
+ # == Searchgasm ActiveRecord
+ #
+ # Hooks into ActiveRecord to add all of the searchgasm functionality into your models. Only uses what is publically available, doesn't dig into internals, and
+ # searchgasm only gets involved when needed.
+ module ActiveRecord
+ end
+end
@@ -1,31 +1,39 @@
module Searchgasm
module ActiveRecord
+ # = Searchgasm ActiveRecord Associations
+ #
+ # These methods hook into ActiveRecords association methods and add in searchgasm functionality.
module Associations
module AssociationCollection
+ # This is an alias method chain. It hook into ActiveRecord's "find" method for associations and checks to see if Searchgasm should get involved.
def find_with_searchgasm(*args)
options = args.extract_options!
args << sanitize_options_with_searchgasm(options)
find_without_searchgasm(*args)
end
+ # See build_conditions under Searchgasm::ActiveRecord::Base. This is the same thing but for associations.
def build_conditions(options = {}, &block)
conditions = @reflection.klass.build_conditions(options, &block)
conditions.scope = scope(:find)[:conditions]
conditions
end
+ # See build_conditions! under Searchgasm::ActiveRecord::Base. This is the same thing but for associations.
def build_conditions!(options = {}, &block)
conditions = @reflection.klass.build_conditions!(options, &block)
conditions.scope = scope(:find)[:conditions]
conditions
end
-
+
+ # See build_search under Searchgasm::ActiveRecord::Base. This is the same thing but for associations.
def build_search(options = {}, &block)
conditions = @reflection.klass.build_search(options, &block)
conditions.scope = scope(:find)[:conditions]
conditions
end
+ # See build_conditions! under Searchgasm::ActiveRecord::Base. This is the same thing but for associations.
def build_search!(options = {}, &block)
conditions = @reflection.klass.build_search!(options, &block)
conditions.scope = scope(:find)[:conditions]
@@ -34,6 +42,7 @@ def build_search!(options = {}, &block)
end
module HasManyAssociation
+ # This is an alias method chain. It hook into ActiveRecord's "calculate" method for has many associations and checks to see if Searchgasm should get involved.
def count_with_searchgasm(*args)
column_name, options = @reflection.klass.send(:construct_count_options_from_args, *args)
count_without_searchgasm(column_name, sanitize_options_with_searchgasm(options))
Oops, something went wrong.

0 comments on commit 4c13dd0

Please sign in to comment.