kernel.org

Git allows you to do a binary search across commits to hunt down the commit that introduced a bug.

In order to redirect all requests from redirecting-host.com to desired-host.com while keeping path and query params unchanged, change your Apache...

makandra dev

If you need to export data from MySQL to a CSV, you can profit from really fast built-in methods...

makandra dev

To clear the query cache in your MySQL database manually, e.g. for database profiling, execute the following command in your...

So you added a new callback to your model that (e.g.) caches some data when it is saved. Now you...

Using this step definition you can check if any form field (text field, checkbox, etc) or button is disabled:

When you eagerly load an association list using the .include option, and at the same time have a .where on...

snippets.dzone.com

These two models can be used to access the posts and associated comments of a WordPress database.

To change the commit message of the latest (unpushed, unmerged) commit, you can use git commit –amend

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

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.

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

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

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:

Use this scope: class Stick named_scope :shuffled, lambda { last_record = last { :conditions => [ 'id >= ?', rand(last_record.id) ] } if last_record }

Use this MySQL command to show further info about a table: SHOW CREATE TABLE tags; This will output a table...

apidock.com

You can now add an :inverse_of option to has_one, has_many and belongs_to associations.... Without :inverse_of...