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...

So you're switching to PostgreSQL from MySQL? Here is some help... General hints on PostgreSQL \? opens the command overview...

apidock.com

When you're writing migrations that do more than changing tables (like, modify many records) you may want some output...

Box shadows are awesome. Unfortunately they are also very costly to render. You will rarely notice the rendering time on...

When you have files in your .gitignore they won't be considered for changes, but still you might want to...

We tend to use database transactions as a magic bullet to get rid of all our concurrency problems. When things...

Consul 0.9 comes with many new features to optimize powers that only check access to a given record. e.g. Power.current.post...

blog.bigbinary.com

Remember why preloading associations "randomly" uses joined tables or multiple queries? If you don't like the cleverness of this...

Active Record's select method allows you to make use of the power of MySQL select statements. On the one...

Merge requests are often rejected for similar reasons. To avoid this, before you send a merge request, please confirm that...

You have multiple options: Just don't have a type column. All STI magic will be disabled automatically.

makandra dev
wikihow.com

Issue this command: sqlite3 ~/Library/Application\ Support/Dock/*.db "DELETE from apps WHERE title='APP_NAME';" && killall Dock This tells sqlite3 to...

Authentication is hard: there are many edge cases, and most users (including yourself) usually only go the "happy path" once...

You can detect city and country from an IP address by using the GeoLite database. This is a flat file...

highscalability.com

Awesome battle report from Pinterest trying to scale their setup using different approaches. When you push something to the limit...

Rails gives you migrations to change your database schema with simple commands like add_column or update. Unfortunately these commands...

Caution when using .where to exclude records from a scope like this: # Fragile - avoid User.where("id NOT IN (?)", excluded_ids...

apidock.com

All columns of a model's database table are automagically available through accessors on the Active Record object.

blog.codeclimate.com

Rails’ reputation as a relatively secure Web framework is well deserved. Out-of-the-box, there is protection against many...

Do not pass times to date attributes. Always convert times to dates when your application uses time zones. Background