Overwrite ActiveRecord gem function in my rails app


I would like to overwrite the function "quote" in
ActiveRecord::ConnectionAdapters::Quoting for my whole rails

Unfortunelty, so far I was nt successfull. Maybe somebody can point me
in the right direction?


The theory I ve understood...
Unfortunelty, ive got no idea how to actually do it.

I ve tried the following:
I ve created a quoting.rb in my rails app lib folder.
module ActiveRecord
  module ConnectionAdapters # :nodoc:
    module Quoting
      def quote(value, column = nil)
        my new code...

Afterwards I ve added a require of my little quoting file into my
environment file... well, but that does not work
So, you mentioned that just reopen the class and ...
How do I actually do that?


Ok, after some further try and errors...
I ve achieved what I want with the following code:
module ActiveRecord
  module ConnectionAdapters # :nodoc:
    class AbstractAdapter
      # Quotes the column value to help prevent
      # {SQL injection attacks}[http://en.wikipedia.org/wiki/
      def quote(value, column = nil)

As suggested, I ve tried this time to overwrite the AbstractAdapter
class and not the quoting module.

Thanks a lot.