# Adding a monkey patch

**URL:** <https://www.ruby-forum.com/t/adding-a-monkey-patch/161377>\
**Category:** Rails\
**Created:** [February 26, 2009, 12:03am UTC](https://www.ruby-forum.com/t/adding-a-monkey-patch/161377 "2009-02-26T00:03:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sygvin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/43a26b/32.png) [@sygvin](https://www.ruby-forum.com/u/sygvin)\
**Post date:** [February 26, 2009, 12:03am UTC](https://www.ruby-forum.com/t/adding-a-monkey-patch/161377/1 "2009-02-26T00:03:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sygvin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/43a26b/32.png) [@sygvin](https://www.ruby-forum.com/u/sygvin)\
**Post date:** [February 26, 2009, 12:14am UTC](https://www.ruby-forum.com/t/adding-a-monkey-patch/161377/2 "2009-02-26T00:14:27Z")

</div>

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
