on 07-31-2008 at 08:35 PM steve wrote: multiple values for block parameter
Not that you would ever do this, but have you ever known anyone who wrote code like: <%= form_tag(:action => ‘inaction’) do |f| %> Well, that’s the function call signature for form_for, and sometime muscle-memory is a bad thing. Adding …on 07-07-2008 at 11:06 PM steve wrote: rSpec: Sending Headers to Controllers
Didja ever wonder how to send a particular HTTP header as part of your functional test or controller spec? Ever wonder who would care about something like that? Read this spec: - PostsController receiving Ajax requests – Should send the infor…on 04-27-2008 at 05:48 PM steve wrote: jQuery Plugins
Today I posted a couple of simple jQuery plugins on github. They are: jquery.focus_first.js jquery.rails_ajax_hook.js You can clone them by doing: git clone git://github.com/sxross/jquery_plugins.git The first one simply sets t…on 04-08-2007 at 02:41 PM steve wrote: Creating New Haml Filters
Recently (like, yesterday), I decided to create a Haml filter to wrap inline Javascript. If you don’t know about Haml, see here. What Haml is, essentially, is a drop-in replacement for Rails’ rhtml. What a filter is, ...on 02-26-2008 at 01:04 PM steve wrote: Getting Depot to Work in Rails 2.0
911 The Depot App in AWDROR Won’t Work Without Scaffolding! As of Rails 2.0, the deprecation warnings came out and so did a number of features present in earlier versions. One of the greatest pain points has been the removal of dynamic scaffoldi…on 01-21-2008 at 11:03 PM Steve wrote: Learn to Program
Nope. This is not an ad for some technical school. Fooled you, huh? This is more about the technique of learning to program. In the olden dayes when computers had core memory and dinosaurs still roamed the earth, there was a high cost associated with c…on 01-02-2008 at 12:10 AM steve wrote: Upgrading to Rails 2.0
Real quick. What’s Gonna Break When I Upgrade to Rails 2.0.2? I’m sure I don’t know the answer to this question, but if you are upgrading an application from a 1.x version of Rails to 2.0.2, something sure will break. Guaran-effing-teed. So, let…on 10-25-2007 at 02:26 PM Steve wrote: Why Copy Protection Is Not Ok
This is an old topic, but one worth revisiting occasionally. Most of us use some commercial software. Perhaps not the Linux-only devs, but on a PC or Mac it’s the norm to purchase some critical applications. For example, although some of the new word p…on 07-18-2007 at 01:52 AM steve wrote: Using Conditional Assignments
Often the programming pattern “set this to such-and-such unless it already has a value” pops up. It’s what default parameters were invented for, but the problem is not limited to function calls. Ruby has a nifty idiom to handle this. Here’s the expa…on 03-27-2007 at 12:04 PM steve wrote: rSpec Redux
If you read my post on rSpec, you may infer that I am trying to track its development. Recently, there have been some changes in trunk worthy of mention. In particular the context/specify syntax has changed to d…on 02-09-2007 at 06:55 PM steve wrote: rSpec—Behavior Driven Development
rSpec is my favorite tool du jour. Test Driven Development is all good and it works, but Behavior Driven Development (BDD) seems far more natural to me. What’s the difference? As much as anything it…on 05-03-2007 at 03:54 PM steve wrote: Testing: Mocking, Stubbing, and Rails, Oh My!
Ruby is a great language and the various test frameworks that support it make writing solid code easier. But… Ruby is a magical language and testing magical things can be a bit … shall we say … interesting. One goal of testing is to predict the f…on 04-17-2007 at 09:17 PM steve wrote: Bootstrapping RSpec Generation
For existing projects, I find myself spec’ing ex-post-facto (which I know is not the true spirit of BDD :). I go through iterations like: read the code and find all the methods put them in a new spec file try to say something interesting a…on 03-30-2007 at 01:35 AM steve wrote: Using ActionMailer with Haml (and others)
Haml has made my Rails development far more precise and the number of display glitches far fewer. But, templating emails remained the exclusive domain of rhtml and its ilk. The challenge has been how to get ActionMailer to recognize what ActionView alr…on 03-22-2007 at 01:22 PM steve wrote: Haml—Great Alternative to Rhtml
I’ve become a true Haml convert. What does that mean? First, what is Haml? Haml is a markup language for Rails that drops in as a plugin and can be used as a substitute for rhtml. Let’s jump right in with a quick example. An Example __rhtml v…on 02-11-2007 at 11:24 PM steve wrote: How Was This Site Built?
A natural question when you look at a site might be, “how did they build that”? Here are the top-line technologies involved in this site: Ruby on Rails Haml Template Language Sass Stylesheets “rSpec Behavi…on 02-11-2007 at 11:06 PM steve wrote: Validation Without a Database Table
Contact forms are a way of life on the Web and so we as developers implement them time and again. One nice touch is to do some validation of the data entered in the form to get higher quality data and lower the spam. Rails offers so much magic in how i…on 02-11-2007 at 10:59 PM steve wrote: Installing “Stock” Plugins
After working with Rails for a bit, we form working habits and one of mine is to install the same plugins for each project. You might do the same. I call these my “base plugins.” Here’s a Rake task that can make this process easier. Usage: rake…