Calling a helper method with the same name as your current partial

Posted About 13 years ago by Henning Koch.

Partials always define a local variable with the same name as themselves. E.g. when you are in _recent_users.html.erb, a local...

Convert RDoc markup to HTML

Posted About 13 years ago by Henning Koch.

If you want to convert a README.rdoc file to HTML, say this from a shell: rdoc README.rdoc

Why preloading associations "randomly" uses joined tables or multiple queries

Posted About 13 years ago by Henning Koch.

ActiveRecord gives you the :include option to load records and their associations in a fixed number of queries. This is...

Default views in Rails 3.0 with custom resolvers

Posted About 13 years ago by Lexy.
blog.plataformatec.com.br

It is common in Rails 3.0 applications that you want to provide default views for a group of controllers. Let...

Opera: How to use outlining for better layout debugging

Posted About 13 years ago by Arne Hartherz.

I prefer using Opera's "User mode" to toggle an outlining of HTML elements quickly. This helps greatly when you...

Cancelling event propagation

Posted About 13 years ago by Tobias Kraze.

Within an event handler, there are multiple methods to cancel event propagation, each with different semantics. event.preventDefault() Only prevents the...

Acceptance testing using Capybara's new RSpec DSL

Posted About 13 years ago by Lexy.
jeffkreeftmeijer.com

Back when Steak was first released, Capybara didn’t have any of the nice RSpec helpers it does now. A...

Caching in Rails

Posted About 13 years ago by Ulrich Berkmueller.

The information in this card is only relevant for Rails 2.3-era apps. This note gives a quick introduction into...

Liquid Canvas

Posted About 13 years ago by Arne Hartherz.
ruzee.com

Liquid Canvas is a JavaScript library which allows you to draw inside an HTML canvas element with an easy yet...

Upgrading Cucumber and Capybara to the latest versions available for Rails 2

Posted About 13 years ago by Ulrich Berkmueller.

Specify these gem versions in your Gemfile: gem 'cucumber', '~> 1.3.0' gem 'cucumber-rails', '= 0.3.2' # max version for Rails 2

Synchronize a Selenium-controlled browser with Capybara

Posted About 13 years ago by Henning Koch.

When you click a link or a press a button on a Selenium-controlled browser, the call will return control...

Convert Adobe Flash FLA files into HTML5 with Wallaby

Posted About 13 years ago by Lexy.
labs.adobe.com

"Wallaby" is the codename for an experimental technology that converts the artwork and animation contained in Adobe® Flash® Professional (FLA...

Check that an element is hidden via CSS with Spreewald

Posted About 13 years ago by Henning Koch.

If you have content inside a page that is hidden by CSS, the following will work with Selenium, but not...

Add a prefix to form field IDs

Posted About 13 years ago by Arne Hartherz.

If you use a form (or form fields) multiple times inside one view, Rails will generate the same id attributes...

Exchange messages between Javascript and Flash

Posted About 13 years ago by Henning Koch.
adobe.com

Flash movies (.swf files) can talk with Javascript code embedded in the same HTML page. There are two ways to...

Continously run command under bash

Posted About 13 years ago by Thomas Eisenbarth.

Sometimes you want to run a command forever, e.g. to compile a haml to html file on the console. Use...

hyphenator

Posted About 13 years ago by Lexy.
code.google.com

Javascript that implements client-side hyphenation of HTML-Documents.

Using Firebug Lite to inspect HTML in Internet Explorer and other browsers

Posted About 13 years ago by Arne Hartherz.
getfirebug.com

You know Firebug as a Firefox extension but there is also a "Lite" version which runs purely off JavaScript.

Dynamic conditions for belongs_to, has_many and has_one associations

Posted About 13 years ago by Henning Koch.

Note: Consider not doing this. Use form models or vanilla methods instead. The :conditions option for Rails associations cannot take...

Perform HTTP basic authentication in Cucumber (with or without Selenium)

Posted About 13 years ago by Henning Koch.

This card describes a Cucumber step that lets you say: When I perform basic authentication as "username/password" and I visit...

Don't mix Array#join and String#html_safe

Posted Over 13 years ago by Henning Koch.

You cannot use Array#join on an array of strings where some strings are html_safe and others are not...

Styling and scaling for mobile devices

Posted Over 13 years ago by Arne Hartherz.
cssdiscussion.com

If you want your application to display properly on iPad, iPhone or Android there are two things to do:

Firefox: Remove dotted border from focused buttons

Posted Over 13 years ago by Henning Koch.

The following Sass will do the trick: button, input[type="reset"], input[type="button"], input[type="submit"], input[type="file...

Cucumber steps to test input fields for equality (with wildcard support)

Posted Over 13 years ago by Henning Koch.

Our collection of the most useful Cucumber steps, Spreewald, now supports exact matching of form fields and lets you use...