Deadlocks only occur if two transactions in separate threads compete for the same rows in the database. They usually (but...

makandra dev

Lets say you need to make a change to a commit OLD_COMMIT, but this is not the most recent...

You can get YAML.load to instantiate any Ruby object by embedding the desired class name into the YAML code. E.g...

If your controller spec never reaches your controller code: Make sure you are signed in. Make sure you are actually...

apidock.com

To temporarily change the current working directory in Ruby, call Dir.chdir with a block. The previous working directory will be...

yehudakatz.com

The first thing you need to understand is that the purpose of refinements in Ruby 2.0 is to make monkey...

If you need to do calculations inside the database and can not use Ruby objects you may run into problems...

When a has_many association basically serves to store a list of associated strings (tags, categories, ...), it can be convenient...

When you just went through a long debug-fest and infested your code with dozens of debug messages, it can...

Note that this card is very old. You might want to use ActiveType for your auto-coerced virtual attributes instead...

Don't insert table rows in a Rails database migration. This will break tests that expect that database to be...

Occasionally some complex query must be processed on the database because building thousands of Ruby objects is impracticable.

To change a commit message of the most recent (unpushed) commit, you can simply use git commit --amend -m 'new...

Plugins (and gems) are typically tested using a complete sample rails application that lives in the spec folder of the...

This collection of Sass mixins enables cross-browser styling (including IE with CSS3PIE) with less lines of code.

This is non-trivial because you need to fake event objects and require different code for different browsers. Luckily, there...

When you use will_paginage to paginate a scope, and you want to obtain the total number of records matched...

makandra dev

This will stash all modifications that you did not git add: git stash -k Note that newly created (and non...

For clarity and traceability, your commit messages should include the ID and title of the Pivotal Tracker story you're...

You most likely never want to do this. But if you do: Model.update_all({:id => new_id}, {:id => old_id...

To only run the next two migrations: rake db:migrate STEP=2 To revert the previous two migrations:

makandra dev

If you need to revert only parts of one or several commits the following workflow can help:

Regular spaces and non-breaking spaces are hard to distinguish for a human. Instead of using the   HTML entity...

Given this class: class Foo class Bar end end If you want to clean up this code with the modularity...