Spring is a Rails application preloader. When debugging e.g. the rails gem, you'll be wondering why your raise, puts...

Programatically invoke Rails generators Require the generator, instantiate it and invoke it (because generators are Thor::Groups, you need...

When you want the table headers to always stay around (e.g. because that table is huuuge), use the code below...

So you have a restangular collection and you want to remove an element from it, after you've successfully deleted...

If you are using Angular and want something like Rails' simple_format which HTML-formats a plain-text input into...

github.com

Now you can say: class Song < ActiveRecord::Base attr_accessor :virtual_attribute assignable_values_for :virtual_attribute do

If you come across an (older) application that is using Prototype instead of jQuery, you may often see events bound...

robots.thoughtbot.com

Declare an enum attribute where the values map to integers in the database, but can be queried by name.

blog.mariadb.org

MariaDB 10 includes numerous innovations developed with and for web-scale players like Google, Fusion-IO and Taobao such as...

medium.com

When you, as a developer, look at the choices used to build a particular application, you’re blown away at...

By default, Rails' validates_uniqueness_of does not consider "username" and "USERNAME" to be a collision. If you use MySQL...

Put the attached file to config/initalizers to ignore some fields for rejecting nested records (e.g. hidden input fields).

When you use a belongs_to or has_many macro you might be surprised that the methods that it generates...

Store each models version in a separate table class Post < ActiveRecord::Base has_paper_trail :class_name => 'PostVersion' end

makandra dev

Just found out about a great feature in Rails that seems to be around since Rails 2. Start a console...

You might have a table without a primary key set in MySQL. You can fix this by adding a primary...

Wondering how a specific method on an object is exactly named? You can use Enumerable#grep to detect it in...

codeka.com.au

For reasons that completely escape me, MySQL 5.x limits UTF-8 strings to U+FFFF and smaller.

Like in any language, a FLOAT has complicated semantics for precision. This sometimes causes stored numbers to be slightly off...

robots.thoughtbot.com

Arel is a library that was introduced in Rails 3 for use in constructing SQL queries. Every time you pass...

robots.thoughtbot.com

Rails 4.0 introduced a helpful new method for ActiveRecord queries: where.not. It can make clunky queries easier to read.

I had a huge MySQL dump that took forever (as in: days) to import, while I actually just wanted to...

dev.mysql.com

A MySQL DECIMAL column is used when it is important to preserve exact precision. It takes two parameters, where...

We have released Modularity 2. It has many incompatible changes. See below for a script to migrate your applications automatically...