public
Description: Rails Sitemap Plugin / Site Map Plugin for Rails. A beautiful rails sitemap plugin that talks to Google, Yahoo and MSN when updated. Sitemap features clean handcrafted XHTML, XML with XSLT and custom finder options for your named routes.
Clone URL: git://github.com/queso/sitemap.git
Search Repo:
Adding custom finders.
queso (author)
Sat Mar 22 21:36:53 -0700 2008
commit  9cce400650ff04e69e76003fa84ccd140c694336
tree    7b6bd506a607de5c58cd9887d98b9f090c39343c
parent  47cc099d266ece9260d66a523ec5d926cb66c567
...
24
25
26
 
27
28
29
...
24
25
26
27
28
29
30
0
@@ -24,6 +24,7 @@
0
       t.string :frequency_index
0
       t.string :frequency_show
0
       t.float :priority
0
+ t.string :custom_finder
0
       
0
       t.timestamps
0
     end
...
9
10
11
12
 
 
13
14
15
16
 
 
 
 
17
18
19
...
9
10
11
 
12
13
14
15
16
17
18
19
20
21
22
23
24
0
@@ -9,11 +9,16 @@
0
   end
0
 
0
   def find_children(options = {})
0
- widget_model_constant.find(:all, options)
0
+ @finder = finder
0
+ widget_model_constant.send @finder, :all, options
0
   end
0
   
0
   def widget_model_constant
0
     widget_model.constantize
0
+ end
0
+
0
+ def finder
0
+ (custom_finder || "find").to_sym
0
   end
0
   
0
 end
...
12
13
14
 
 
 
 
 
15
16
17
...
12
13
14
15
16
17
18
19
20
21
22
0
@@ -12,6 +12,11 @@
0
 </p>
0
 
0
 <p>
0
+ <%= f.label :custom_finder, "A custom ActiveRecord finder method, leave blank for find(:all)" %>
0
+ <%= f.text_field :custom_finder %>
0
+</p>
0
+
0
+<p>
0
   <%= f.label :frequency_index, "How often does the widget index page change?" %>
0
   <%= f.select :frequency_index, SitemapWidget.frequencies %>
0
 </p>

Comments

    No one has commented yet.