A check if two date or time ranges A and B overlap needs to cover a lot of cases:

This might be due to AppArmor denying the MySQL server access to most of the filesystem. You can instead use...

There are times when you need to send SQL to the database, like this: def self.some_count(field) field = connection.quote...

opensoul.org

I love ETags, but there’s something that annoys me: most implementations revolve around pulling a record out of a...

In regular expressions you can use the zero-width pattern \b to match the beginning or end of a word...

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

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

RSpec 1, RSpec 2 To test whether two arrays have the same elements regardless of order, RSpec 1 and 2...

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

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

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

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

As a user of Bundler you have spent significant time looking at this message: Fetching source index for http://rubygems.org...

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

CONCAT('foo', 'bar', NULL) = NULL the NULL always wins in MySQL. If you would rather treat NULL as...

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

If a controller action responds to other formats than HTML (XML, PDF, Excel, JSON, ...), you can reach that code in...

If you want to see how long your database queries actually take, you need to disable MySQL's query cache...

It can be useful to have a Ruby expression like condition ? positive_case : negative_case in MySQL queries: