Posts tagged "rails"

Exporting data to CSV and Excel in your Rails apps

Sometimes users want to slice and dice data as they wish. In such scenarios, it’s usual to export the data in a tabular format so your users can use any spreadsheet editor and do whatever they want. Usually, we do that using CSV, right? OpenOffice and other editors can open CSV files flawlessly. Just double-click … »

How to avoid the dog-pile effect on your Rails app

Everyone already heard about scalability at least once. Everyone already heard about memcached as well. What not everyone might heard is the dog-pile effect and how to avoid it. But before we start, let’s take a look on how to use Rails with memcached. Rails + Memcached = expires_at && !exist?(“lock_#{key}”) orig_write(“lock_#{key}”, true, :expires_in => … »

Do not burden your users with validations

One of the first things we learn in Rails which are greatly useful are ActiveRecord validations. However, since they are easy to add, it happens frequently that we are burdening our users with validations instead of making forms easier and clearer. For instance, let’s suppose we are validating the Social Security Number (SSN) of an … »

Inherited Resources is scopes and responder fluent

First, what is Inherited Resources? Inherited Resources is a gem/plugin that allows you to speed up development by making your controllers inherit all restful actions so you just have to focus on what is important. A Rails scaffold controller which responds to html, xml and json is as simple as: class ProjectsController < InheritedResources::Base respond_to ... »

Embracing REST with mind, body and soul

UPDATE: ActionController::Renderer was renamed to ActionController::Responder, so this post was changed to properly reflect such changes. About two and a half years ago, resources started to be a first class citizen in Rails when version 1.2 was released and it was all about RESTful admiration and HTTP Lovefest. Since then we’ve added map.resources to our … »

Creating your own generators with Thor

This summer I was selected with Josh Peek, Emilio Tagua and Nelson Crespo to work with Rails on Google Summer of Code (GSoC), which Nelson named as the Rails Summer Quartet. 🙂 Here, at Plataforma, we use a set of tools on our projects, which includes Inherited Resources, Remarkable and Formtastic. At some point, we … »