When mapping a Backbone Model directly to a REST API it is common for the resource you’re accessing to have a nested or associated resources. Backbone Models are a wrapper for a single resource, but do not attempt to implement a nested resource relationship. Backbone Collections also provide a nice mechanism to fetch multiple resources […]
Using Sprockets in Rails 3.1 can be a little tricky. It wasn’t hard to get Sprockets compiling CSS files from SASS into CSS. However, it became difficult when we wanted to use a compass mixin and put erb assets into our sass files. Here’s what we did to get it to work 1. Install the […]
At some point having all of your features in a single directory maybe become an issue. Cucumber allows you to add feature subdirectories for organization. Subdirectories work as expected when running the entire cucumber suite. However, when executing a single feature located in a subdirectory cucumber doesn’t load the web_steps.rb or other support files in […]
When creating a migration using Ruby on Rails and MySQL, the default MySQL type created when defining an integer field is an 11-digit signed int. This will allow you to store signed integers up to 2147483647. However MySQL has the BIGINT storage type which stores signed integers up to 9223372036854775807.
When working with large databases, SQL structure effects query performance dramatically. I recently refactored a query that looked like this: </p> <pre> SELECT * FROM t1 WHERE t1.a IN (SELECT t2.b FROM t2 where t2.c = 1)</pre> <p> Refactored into: </p> <pre> SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.b AND t2.c […]