Subscribe to
Posts
Comments

Archive for the 'Rails' Category

Self-conscious Decoration

Variations on the Decorator Design Pattern in Ruby have already been discussed in several places. For my special purpose, none of these approaches works. The common problem with a decorator based on delegation is the lost sense of self. Method calls of the decorated object to itself are not routed through the decorator, therefore remain [...]

Rails valid markup testing

Coda Hale has given the intersection of the Rails and web standards communities a very nice plugin for keeping your markup clean. It is aptly, if slightly pretentiously, named Responsible Markup. But let’s be honest, do you really want to spend much time on writing tests for your markup? After all, it’s taking long enough [...]

ActiveRecord Enumerable

Ever wanted to iterate over a huge number of objects and found that find(:all) doesn’t cut it? Then this plugin might be for you. Install it with $ script/plugin install svn://rubyforge.org/var/svn/ar-enumerable/ar_enumerable/trunk First, a note of caution. This plugin has not seen much practical use yet, in its current state it is only slightly above a [...]

Auto-completion for tag lists

See the end of this post for an important update. Standard Rails auto-completion is geared toward completing a single value entered in a text field. For most cases this is exactly what’s needed, but there is one prominent case that is different: auto-completion of tags. If something can have a tag at all, it’s part [...]

I’m using Eclipse with RadRails to edit my Ruby and Rails code (and, yes, I’ve used it for Java, way back when). Inside Eclipse the various text editors offer so-called templates. These are snippets of common code with placeholders for variable bits. Type in the abbreviation for a template, then type Ctrl-Space and the abbreviation [...]

Ruby on Rails already does a good job of specifying almost declaratively what conditions objects must meet to be considered valid–that is, how they are validated. Thus, in order to make sure that a Person’s last_name attribute does not exceed 100 characters, you would write something like this class Person < ActiveRecord::Base validates_length_of :last_name, :maximum [...]

« Prev

Fork me on GitHub