title: Overriding a module method from a gem in Rails
body: <p>The will_paginate gem is broken on my version of Oracle. The default <code>paginate_by_sql</code> method in the WillPaginate module is inserting an extra 'AS' into a query and causing it to fail.</p>
  
  <p>The code itself is easily fixed, but I'm not sure of the best way to get Rails to pick up my change.</p>
  
  <p>I don't want to change the code in the gem itself, as that will leave my code broken on other machines.</p>
  
  <p>I tried creating an lib/test.rb file containing:</p>
  
  <pre><code>module WillPaginate
    def paginate_by_sql
      (my code goes here)
    end
  end
  </code></pre>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>I'm sure there's an easy way to do this, but I'm not having any luck tracking it down using Google.</p>