0

I want to change mysql2_adapter.rb located in /home/jimcgh/.rvm/gems/ruby-2.0.0-p353@myproject/gems/activerecord-3.2.13/lib/active_record/connection_adapters.

I want to redefine the connect method as follows

def connect
        @connection = Mysql2::Client.new(@config)
        @connection.options(Mysql::OPT_LOCAL_INFILE, 1) #Im adding this line
        configure_connection
end

If i just make this change, will it reflect in my rails app ?. Is there a better way to do this change?

Please Help Thank You

jimcgh
  • 5,637
  • 4
  • 27
  • 37

1 Answers1

0

the best thing to do is fork the github repository, then commit the changes.

then, on your gem file reference it like this:

gem 'activerecord', :git => '##New git Repo##'

this way you wont have problems in production afterwards

Another solution is try to override the gem method on your application, here is another SO question on the topic:

Overriding a module method from a gem in Rails

Community
  • 1
  • 1
Rodrigo Zurek
  • 4,555
  • 7
  • 33
  • 45