TL;DR: depending on your app, using define_method is faster on boot, consumes less memory, and probably doesn't significantly impact ...
Link: tenderlovemaking.com
I posted a benchmark on twitter about comparing a DateTime with a string. This is a short blurrrggghhh post about the benchmark and why there is such a performance discrepancy. Here is the benchmark: require 'benchmark/ips' require 'active_support/all' if ENV['AS'] require 'date' now ...
Our attacker knows that this class is defined in the system. Using YAML, along with Psych’s object deserialization, they can inject any object in to the system they choose. So how can they use this object? Let’s take a look at the YAML payload for exploiting this code, then talk about...
2013-03-03 @ 16:52 Dynamic Method Definitions TL;DR: depending on your app, using define_method is faster on boot, consumes less memory, and probably doesn’t signigicantly impact performance. Throughout the Rails code base, I typically see dynamic methods defined using class_eval . Wh...
Right now people who publish native gems targeting the windows platform have a problem. Our problem is supporting ruby 1.8 and 1.9 at the same time. Right now, we can’t build one gem targeting 1.8 and one gem targeting 1.9, and have rubygems differentiate the two. I have a solution: f...
TL;DR This is your periodic reminder to specify dependency versions in your Gemfile I started updating one of our larger projects at work to use edge Rails. This project uses devise, and the Gemfile declares the dependency like this: gem "devise" The latest version of devise correctly...
Ruby 1.9 will return true for public and protected methods, but false for private methods. If we compare this to actually calling the method, we’ll see an inconsistent behavior. Let’s interleave respond_to? checks along with calling the method to see what happens:
Besides enabling multi-threading by default, one of the things I really wanted for Rails 4.0 is the ability to stream data to the client. I want the ability to treat the response object as an I/O object, and have the data I write immediately available to the client. Essentially, the a...
A while back a ticket was filed on the Rails tracker to turn on config.threadsafe! mode by default in production . Unfortunately, this change was met with some resistance. Rather than make resistance to change a negative thing, I would like to make it a positive thing by talking about...