public
Fork of mislav/will_paginate
Description: Most awesome pagination solution for Rails
Homepage: http://github.com/mislav/will_paginate/wikis
Clone URL: git://github.com/technoweenie/will_paginate.git
Search Repo:
Fix edge case with count_by_sql and Oracle.
References #187  [Jan Berkel]


git-svn-id: svn://errtheblog.com/svn/plugins/will_paginate@453 
1eaa51fe-a21a-0410-9c2e-ae7a00a434c4
mislav (author)
Wed Feb 27 12:35:19 -0800 2008
commit  6b77787c18d6e7947adbe2e55491459d64bc0564
tree    d05c5e14d30b2e1a34c3ebf5b649dd03581ef39f
parent  ac279ca9bff6b1864ea36e9b6c89ea0254cba7dc
0
...
125
126
127
128
 
129
130
131
...
125
126
127
 
128
129
130
131
0
@@ -125,7 +125,7 @@ contributions or simply awesome ideas:
0
 
0
 Chris Wanstrath, Dr. Nic Williams, K. Adam Christensen, Mike Garey, Bence
0
 Golda, Matt Aimonetti, Charles Brian Quinn, Desi McAdam, James Coglan, Matijs
0
-van Zuijlen, Maria, Brendan Ribera, Todd Willey, Bryan Helmkamp.
0
+van Zuijlen, Maria, Brendan Ribera, Todd Willey, Bryan Helmkamp, Jan Berkel.
0
 
0
 == Usable pagination in the UI
0
 
...
111
112
113
114
 
 
 
 
 
115
116
117
...
111
112
113
 
114
115
116
117
118
119
120
121
0
@@ -111,7 +111,11 @@ module WillPaginate
0
           
0
           unless pager.total_entries
0
             count_query = original_query.sub /\bORDER\s+BY\s+[\w`,\s]+$/mi, ''
0
- count_query = "SELECT COUNT(*) FROM (#{count_query}) AS count_table"
0
+ count_query = "SELECT COUNT(*) FROM (#{count_query})"
0
+
0
+ unless ['oracle', 'oci'].include?(self.connection.adapter_name.downcase)
0
+ count_query << ' AS count_table'
0
+ end
0
             # perform the count query
0
             pager.total_entries = count_by_sql(count_query)
0
           end
...
18
19
20
21
22
23
24
 
 
25
...
18
19
20
 
21
 
22
23
24
25
0
@@ -18,8 +18,8 @@ end
0
 # Wrap tests that use Mocha and skip if unavailable.
0
 def uses_mocha(test_name)
0
   require 'mocha' unless Object.const_defined?(:Mocha)
0
- yield
0
 rescue LoadError => load_error
0
- raise unless load_error.message =~ /mocha/i
0
   $stderr.puts "Skipping #{test_name} tests. `gem install mocha` and try again."
0
+else
0
+ yield
0
 end

Comments

    No one has commented yet.