Rails Best Practices

A collection of tips showing best practices programming on Ruby on Rails.


Python vs Ruby and Django vs. Rails



Rails application architecture tips



LiveReload for Rails app (on gist.github.com)


Delayed jobs, Sidekiq, Resque, God

Send asynchronious emails with ActionMailer and Sidekiq

God + Resque, gist: https://gist.github.com/maxivak/05847dc7f558d5ef282e



Deploy a Rails app with Capistrano 3  (Example on Github)



Run RSpec tests as a Rake task

Running Selenium tests with Ruby on Centos

Examples of RSpec tests with Capybara, Selenium, Headless


Create own Gems

Creating your own gems


Custom controller actions in ActiveAdmin



Solr search engine with Sunspot gem


Spree shop


Code examples

ActiveRecord, Models:

update_attribute, update_attributes and update_column

Get a list of IDs from database

How to pass multiple attributes to find_or_create_by

How to determine if a record was created or updated in after_save callback



custom submit button in simple_form for Bootstrap 3

Nested Models in one form using Formtastic and Cocoon gems



Clear old sessions stored in database

Sessions do not work in Internet Explorer in Rails


Disable logging of asset pipeline messages

Using CDN with Rails assets



Send email to multiple recipients



* generate-sitemap-xml-for-rails-4-application/ (gist)



TinyMCE 4 text editor + elFinder file manager




Loading “Seed” Data

attr_accessor vs attr_accessible

Link to download an image as attachment in Rails (send_file and remote files)

Cropping and resizing images using MiniMagick

Redirect from www to non-www version of site

Password protecting pages of Rails App

Custom slugs using gem Slugged



Countries, Cities

Select Tag with List of Countries



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>