Articles on Rails

Jeremy Morony

Jeremy Morony

A Strategy for Loading Page Specific JavaScript

Since the introduction of the asset pipeline, managing javascript assets in a typical rails application is pretty straight forward. You figure out some structure for organizing the files under app/assets/javascripts/, concatenate them together with some directives in application.js, and that file is most likely included in a layout and you’re on your way. But what

Christian Nelson

Christian Nelson

Raygun: Hit the Ground Running When You Start Your Next Project

We start new Rails projects all the time, for client, side and internal projects. Each time we do the dance to get things just the way we like them. You probably have a similar process: switch the view library, set the database, use rspec, tweak this and that, etc. Even when you do it all

Christian Nelson

Christian Nelson

Project/Technology Showcase, April 25th

Carbon Five and Good Eggs are joining up to show off some of the projects they’ve recently worked with an emphasis on the technology that made them possible. We want to share what we think is interesting and what we’ve learned along the way. Genetic Symphony – A Genentech, IDEO, and Carbon Five collaboration for

Primary rainbow
Jared Carroll

Jared Carroll

How to Test External APIs

Integrating with an external API is almost a guarantee in any modern web app. To effectively test such integration, you need to stub it out. A good stub should be easy to create and consistently up-to-date with actual, current API responses. In this post, we’ll outline a testing strategy using stubs for an external API.

Purple waves
Jared Carroll

Jared Carroll

Supporting Cross-Domain AJAX in Rails using JSONP and CORS

The recent rise in popularity of client-side JavaScript MVC frameworks has led to a revival of web apps with thick clients. As more logic is moved to the client-side, the need to communicate with servers in different domains becomes more common. Unfortunately, JavaScript’s same origin policy prohibits you from making a request to a server

Jared Carroll

Jared Carroll

Beginning Outside-In Rails Development with Cucumber and RSpec

The RSpec Book defines outside-in Rails development as starting with views and working your way in toward the models. By developing from the outside in, you are always taking a client perspective at each layer of the application. The end result is an absolute minimum implementation, consisting of simple, expressive interfaces. Outside-in development doesn’t require

Red paint
Jared Carroll

Jared Carroll

Does My Rails App Need a Service Layer?

Sometimes during domain modeling you come across something that isn’t a thing. These operations that don’t quite belong to an object are called services. Services often live in a separate, service layer. The service layer lies between controllers and models, defining an application’s interface, its API. Designing with services and a service layer is popular

Jared Carroll

Jared Carroll

Exploring Client-side MVC with Backbone.js

Backbone.js continues to gain popularity in the JavaScript MVC community. I decided to give it a try by creating a simple, single-page app to CRUD a single domain model. While it wasn’t as trivial as a traditional server-side implementation in Rails, it did turn out relatively clean. This is a long post, and if you

Jared Carroll

Jared Carroll

Modern Cucumber and Rails: No More Training Wheels

Last month, cucumber-rails 1.1 was released. This release removed web_steps.rb, a collection of step definitions for interacting with a web app. For months, web_steps.rb contained a warning of its negative effects on feature maintenance. Like most developers, I ignored the warning. During a recent upgrade of an existing Rails app, I realized it was now

August Jaenicke

August Jaenicke

Valium extracts Model attributes without instantiating ActiveRecord objects

I was recently on a project that captures and logs data as ActiveRecord models.  Each datum had 10 or so numeric attributes.  One story required pulling out all the values for a particular attribute in a time range (i.e. all the temperatures for the last week).  This could involve 1000’s of rows from the database.