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...
Update RubyGems and Passenger Bundler requires Rubygems >= 1.3.6. Run gem update --system if you have an older version.
Sometimes you want to fetch associations for an ActiveRecord that you already loaded, e.g. when it has deeply nested associations...
There are three ways to define your own RSpec matchers, with increasing complexibility and options: 1) Use RSpec::Matchers.define
When you need to add a event listener to hundreds of elements, this might slow down the browser. An alternative...
With this plugin, you can create a scalable tooltip by just using a single background image for the tooltip body...