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:

You can usually just use the eq matched to compare two numbers: expect(deal.total).to eq(120)

opensoul.org

How to create an infinitely nestable hash that always defaults to a new hash if a key does not map...

github.com

Ruby's net/http is setup to never verify SSL certificates by default. Most ruby libraries do the same. That means...

gurge.com

How to write to the db 27,000 times in 24 seconds instead of 9 minutes.

You can use these step definitions: Then /^I should not see an error$/ do (200 .. 399).should include(page.status_code...

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

opensoul.org

Sometimes, you just need to shoot from the hip…or deploy your local changes without committing them. Put this snippet...

If you want to find out whether a Class object is directly inheriting from another class, use superclass: ActiveRecord::RecordNotFound.super...

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

Use the htmlentities gem. Encoding works like this: require 'htmlentities' coder = HTMLEntities.new string = "<élan>" coder.encode(string) # => "&lt;élan&gt;"

snippets.dzone.com

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

makandra dev

If you modified git's history and the change was already pushed, you will usually get a ! [rejected] my-branch...

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

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

Use the Launchy gem: Launchy.open('http://www.ruby-lang.org/')

tug.dk

Gallery of fonts you can use without much hassle in LaTeX. The license of the fonts vary, but are all...

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