Posts tagged "rails"

Devise: flexible authentication solution for Rails

UPDATE: This post was an introduction to Devise and a couple of things changed since then. There is a more recent post which describes the same steps as below using generators and, for a more complete and always updated explanation, please check the README. In Rails Summit Latin America 2009, we showed Devise in a … »

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 … »