Forum: Ruby on Rails Adding a monkey patch

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
71ea136e54ad58eacf6ca59a99b27ffe?d=identicon&s=25 Vinay Bg (sygvin)
on 2009-02-26 00:03
Hi

/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.0/lib/active_record/connection_adapters/mysql_adapter.rb
(class Mysql adapter)

there is a call
def create_table(table_name, options = {}) #:nodoc:
        super(table_name, options.reverse_merge(:options =>
"ENGINE=InnoDB"))


I have a monkey patch in the name active_record_ndbcluster.rb and it has


module ActiveRecord
  module ConnectionAdapters
    class MysqlAdapter
        def create_table(table_name, options = {}) #:nodoc:
        super(table_name, options.reverse_merge(:options =>
"ENGINE=NDBCLUSTER"))
        end
    end
  end
end


now where do i place this patch.

when i placed it in ~/web/lib/

it doesn't work. ~/web is the ruby on rails directory.


Thanks
71ea136e54ad58eacf6ca59a99b27ffe?d=identicon&s=25 Vinay Bg (sygvin)
on 2009-02-26 00:14
config/initializers :)

and it works!!


Vinay Bg wrote:
> Hi
>
> 
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.0/lib/active_record/connection_adapters/mysql_adapter.rb
> (class Mysql adapter)
>
> there is a call
> def create_table(table_name, options = {}) #:nodoc:
>         super(table_name, options.reverse_merge(:options =>
> "ENGINE=InnoDB"))
>
>
> I have a monkey patch in the name active_record_ndbcluster.rb and it has
>
>
> module ActiveRecord
>   module ConnectionAdapters
>     class MysqlAdapter
>         def create_table(table_name, options = {}) #:nodoc:
>         super(table_name, options.reverse_merge(:options =>
> "ENGINE=NDBCLUSTER"))
>         end
>     end
>   end
> end
>
>
> now where do i place this patch.
>
> when i placed it in ~/web/lib/
>
> it doesn't work. ~/web is the ruby on rails directory.
>
>
> Thanks
This topic is locked and can not be replied to.