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...
Store each models version in a separate table class Post < ActiveRecord::Base has_paper_trail :class_name => 'PostVersion' end
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...
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...
Arel is a library that was introduced in Rails 3 for use in constructing SQL queries. Every time you pass...
I had a huge MySQL dump that took forever (as in: days) to import, while I actually just wanted to...
A MySQL DECIMAL column is used when it is important to preserve exact precision. It takes two parameters, where...
When you do something like this in your code: def var_value @var ||= some_expensive_calculation end
Give the table a style table-layout: fixed Give the cells in the first row a width The same width...
TLDR: This card explains which threads and processes interact with each other when you run a Selenium test with Capybara...
tl;dr: Using has_many associations with a :through option can lead to lost or duplicate records. You should avoid...
We've since created ActiveType which has a restricted subset of Virtus' features. It might be enough for your needs...
This error occurs when you already have a database.yml which defines the database for the cucumber environment instead of test...
When you want to find out the data type of an attribute, you can just use ActiveRecord's columns_hash...
Usually our mysql queries are not case sensitive. In order to query case sensitive, you can use the mysql COLLATE...
Whenever you create a table from a database migration, remember to add updated_at and created_at timestamps to that...
Ubuntu has a package mysql-sandbox that lets you install multiple MySQL versions into your user home: Install mysql-sandbox...
When writing Rails migrations to convert a string column to an integer you'd usually say: change_column :table_name...
I recently experienced the error ActiveRecord::StatementInvalid: Mysql2::Error: closed MySQL connection. Apparently this happens when there is a timeout...
There may be reasons to change the locale of your Postgres cluster. A popular one is your development system's...