If you want to see how long your database queries actually take, you need to disable MySQL's query cache...
Hooks lets you define hooks declaratively in your ruby class. You can add callbacks to your hook, which will be...
It can be useful to have a Ruby expression like condition ? positive_case : negative_case in MySQL queries:
A good tool to generate strong passwords and secrets is "apg". You can get it with sudo apt-get install...
You need to install the following packages before you can build the Paperclip gem: sudo apt-get install imagemagick librmagick...
These steps are now part of Spreewald. This note describes a Cucumber step that lets you write this:
Both these approaches will keep your GET parameters -- and will only work for GET requests. Capybara: When /^I reload the...
When you need to delete rows from a table, and the delete conditions require a joined table, MySQL needs to...
You can use record.send(:update_without_callbacks) or record.send(:create_without_callbacks) This can be used as a...
For some reason you want to define a find condition in array form. And in that condition both column name...
Find conditions for scopes can be given either as an array (:conditions => ['state = ?', 'draft']) or a hash (:conditions => { 'state' => 'draft...
When using virtual attributes, the attached trait can be useful to automatically copy errors from one attribute to another.
power-rake db:migrate VERSION=20100913132321 By default the environments development, test, cucumber and performance are considered...
There are many different methods that allow mapping an Array to a Hash in Ruby. Array#to_h with a...
When Paperclip attachments should only be downloadable for selected users, there are three ways to go. The same applies to...
The CSS Emoticons plugin is a simple jQuery plugin (and stylesheet) that allows you to turn any text emoticons on...
In modern Rails versions you can also use ActiveRecord's pluck method. User.active.pluck(:id) => [1, 5, 23, 42]
You should test the callback methods and its correct invocation in two separate tests. Understand the ActiveRecord note before you...
You can use the whatlanguage gem to detect the language of a Ruby string. Note that it also has not...
When you load a record with find options that have SQL fragments in :select or :joins, ActiveRecord will make that...
Captify is a plugin for jQuery written by Brian Reavis (@brianreavis) to display simple, pretty image captions that appear on...
A jQuery plugin that sets a div or span to show a countdown to a given time
When submitting textareas, browsers sometimes include carriage returns (\r) instead of just line feeds (\n) at the end of each...
The state_machine gem ships with a scope with_state. This scope has some problems in complex queries or scope...