Archive for Rails

Capistrano 3 – How to run a custom rake task on the server

Here is a little nice task to put in your /lib/capistrano/tasks folder. This will allow you to run any rake task on the server. Then just run it by doing:

Continue reading →

Create Rails app with RVM to set ruby version and gemset from directory

I’ve always chosen which version and gemset to use with RVM by writing in the console before entering an application. I today found a nice little trick to make RVM understand this itself whenever you enter the directory of your new Rails app. So here…

Continue reading →

Awesome error handling in Rails

One thing developers always want is kick-ass error handling. Most frameworks have pretty poor support for this and you usually need to use a debugger to get to the bottom of a bug. However, with some help from a few nifty gem’s, you can get…

Continue reading →

How to serve assets via Amazon S3 & Cloudfront for Rails 4 with Paperclip

We are working hard to get our new project up and running. It will be a website aimed for food lovers built with Ruby On Rails. In order to make the server super-snappy we have decided to use Amazon S3 for file storage and have…

Continue reading →

Upgrading from Rails 4 Beta1 to Rc1

When you are upgrading from Rails 4 Beta1 to the newly released Rc1 you might run into some problems. I got this one: The fix is to edit the file located in config/initializers/session_store.rb and change from to Voila!

Continue reading →

FIX: Capistrano deploy fails after changing repository URL

We have moved some of our clients repositories from Github to Bitbucket but when we tried to deploy we got the following error: I tried making a clean-up but that didn’t work. The solution however is pretty straight forward. You just need to login to…

Continue reading →

How-to: Show SQL database query in rails console

When you are optimizing your database queries it might be nice to use the console and try out the changes in real time. However, by default you won’t see the query that is sent to the database by default which is a nice feature to…

Continue reading →

acts-as-nested-set ArgumentError Fix

Sometimes you can get this weird error when using acts-as-nested-set: To fix this you just fire up the console and rebuild your model. Woop!

Continue reading →

My highlights from the new Rails 3.2.3

I’ve been reading up on the news in Rails 3.2 and here are the stuff I think is worth highlighting to remember Active record Fetch only the “name” column from the model. Fetch unique only Fetch first, or if it doesn’t exist, create it Other…

Continue reading →

Some notes on Sphinx & Thinking Sphinx

If you ever have developed search solutions for a web application you probably are familiar with the hazzle attached to it. There are lots of stuff to think about and performance is often an issue when dealing with large sets of data. One of the…

Continue reading →