Bad Bad Monkey (patch) 6

Posted by Joel Jensen Sun, 13 Feb 2011 22:56:00 GMT

George

Ruby, and Rails let you extend classes. This is called monkeypatching. Rails is built using that ability, It’s pretty important. I’ve used it on and off for years. You have to be careful when you use it, very powerful.

I just got done debugging some bad Monkeypatching, In my opionion you should NEVER mess with activerecord unless you really really know what you are doing. In this case the developer replaced the save method, which I didn’t think was good. What if the boolean class True was set to return nil?. Bugs in this type of code are impossible to find.

 

    class Boolean
        def True
            nil
        end
    end

 

 

 

 

Comments

Leave a comment

  1. Flange 7 months later:

    the blog post is really the freshest on this noteworthy theme. I harmonize with your conclusions and will thirstily look forward to hear your coming updates. I will tell you something about useful Welded wire mesh,wire meshes and so on.

  2. inverter generator 7 months later:

    Oh, so unexpected, so surprise! Very touching, so well written and I have some perception, learning very much.portable generators

  3. Lexia 3 9 months later:

    Very good article. I learned a lot. Hope that the next and then it can understand more things. Very grateful.

  4. Cornelius M. Amato 10 months later:

    Are you planning a destination wedding? Impression Bridal has an exclusive line of simple wedding dresses to suit every need of the non- traditional bride. Casual beach wedding dresses are made with premium, featherweight fabrics like charmeuse, silk and chiffon, making them easy to pack, which is ideal for travel.

  5. Home Security Houston 10 months later:

    Among those posts I’ve seen, this is the most particular one, and I think the blogger must have spent lots of time on it, thank you so much!Home Security Houston

  6. trx for sale 10 months later:

    I’ve learned that hot British film actor TRX Rip Trainer

Comments