Upgrading from 0.8.5 to 0.8.8, I ran across some docs that I forgot to push
upstream.

Is hobo/lib/hobo/scopes/apply_scopes.rb the right place for this sort of
discussion?  There's a better place to put this, yes?

    - Scott



index b87a8eb..24a0747 100644
--- a/hobo/lib/hobo/scopes/apply_scopes.rb
+++ b/hobo/lib/hobo/scopes/apply_scopes.rb
@@ -4,6 +4,32 @@ module Hobo

     module ApplyScopes

+# Applies any number of scopes to the finder.
+# Pass a hash of scope-name => scope-values, i.e.:
+#
+#       User.apply_scopes(:first_name_is => params[:first_name],
+#                         :last_name_is  => params[:last_name])
+#
+# A scope will be ignored if scope-arguments is blank (or, if
+# scope-arguments is an array, if the first item of the array is blank).
+# That allows scopes to be skipped if you don't specify the value
+# (presumably, if params[:last_name] is blank
+#
+# Here is an example of using apply_scopes with table-plus:
+#  in user/index.dryml:
+#     <page-nav/>
+#     <table-plus fields="this, first_name, last_name, gender, created_at">
+#       <filter-menu param-name="gender" options="&['Male', 'Female']"/>
+#     </table-plus>
+#     <page-nav/>
+#
+#  in controllers/users_controller.rb:
+#     User.apply_scopes(
+#       :search => [params[:search], :first_name, :last_name],
+#       :order_by => parse_sort_param(:first_name, :last_name, :gender,
:created_at),
+#       :gender_is => params[:gender]
+#     )
+
       def apply_scopes(scopes)
         result = self
         scopes.each_pair do |scope, arg|

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to hobousers@googlegroups.com
To unsubscribe from this group, send email to 
hobousers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to