When you're writing migrations that do more than changing tables (like, modify many records) you may want some output...
When two classes implement the same behavior (methods, callbacks, etc.), you should extract that behavior into a trait or module...
Shared example groups are a useful RSpec feature. Unfortunately the default directory structure generated by rspec-rails has no obvious...
Extends the Chrome WebInspector so you can debug AngularJS applications and hunt down performance issues. It's really, really good...
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...
Remember why preloading associations "randomly" uses joined tables or multiple queries? If you don't like the cleverness of this...
1. Saving files to a directory that is not shared between deploys or servers If you save your uploads to...
This card shows how to upgrade a Rails 2 application from Rails 2.3.8 through every single patch level up to...
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...
Do it like this: attribute :active, Virtus::Attribute::Boolean Long story In Virtus you define attribute with their type...
When you need to find out in which kind of spec you are during run-time, it's definitely possible...
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...
We have often felt the pain where our models need to serve too many masters. E.g. we are adding a...
In the following example the method update_offices_people_count won't be called when office_id changes, because it...
You can detect city and country from an IP address by using the GeoLite database. This is a flat file...
When using the json gem, you might run into this error when using JSON.parse: >> json = 'foo'.to_json >> JSON.parse(json...
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...
Non-SSL contents on SSL pages are blocked by default Bug 834836 – Turn on pref to block mixed active content...
All columns of a model's database table are automagically available through accessors on the Active Record object.