Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 131607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:07:55+00:00 2026-05-11T06:07:55+00:00

The will_paginate gem is broken on my version of Oracle. The default paginate_by_sql method

  • 0

The will_paginate gem is broken on my version of Oracle. The default paginate_by_sql method in the WillPaginate module is inserting an extra ‘AS’ into a query and causing it to fail.

The code itself is easily fixed, but I’m not sure of the best way to get Rails to pick up my change.

I don’t want to change the code in the gem itself, as that will leave my code broken on other machines.

I tried creating an lib/test.rb file containing:

module WillPaginate   def paginate_by_sql     (my code goes here)   end end 

and requiring it from environment.rb, but it’s not picking up my changes. I also tried requiring it from controllers/application.rb, but again, not picking up my changes.

Temporarily, I got it to work by overriding the method within the specific model itself, but this is a bit of a hack, and means I can’t use it on any of the other models in this project.

I’m sure there’s an easy way to do this, but I’m not having any luck tracking it down using Google.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T06:07:56+00:00Added an answer on May 11, 2026 at 6:07 am

    What you are doing will work, but your code needs to look like this:

    module WillPaginate   module Finder     module ClassMethods       def paginate_by_sql(sql, options)         # your code here       end     end   end end 

    In other words, go into finder.rb, delete everything except the module headers and the method you want to override, then save to a file in lib and include in environment.rb. Voila, instant monkey patch!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the will_paginate gem. The default is 30 elements per page. How do
I'm using the will_paginate gem to display a collection in a paginated fashion. Now
I'm using the will_paginate gem for my Rails project and it's working beautifully. Unfortunately,
I'm using the will paginate gem from http://github.com/mislav/will_paginate Routes: map.resources :post do |post| post.resources
In my Rails application I want to use the will_paginate gem to paginate on
I'm using the Rails3 beta, will_paginate gem, and the geokit gem & plugin. As
I just installed the gem for will_paginate and it says that it was installed
Is there an easy way, to default will_paginate to last page? I would like
Lets use a real world example. I want to monkey patch WillPaginate::LinkRenderer.to_html method. So
I've installed will_paginate with Gem and Bundle; now I see there's an update on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.