Twitter Updates

Validating existing model records in Rails

One problem that crops up as a Ruby on Rails application evolves is that new attributes are added to existing models, sometimes with new validation rules. For example, you may have a Customer model with name, address, email and phone number, then realize you want to add an attribute to store email marketing preferences many

Continue reading Validating existing model records in Rails

Testing RESTful Rails controllers by POSTing XML

I ran into a problem this morning trying to test a Rails controller with an XML document that needed to made in an HTTP POST request. It turns out that it’s actually pretty easy using Rails IntegrationTest and a couple small tweaks:

class MyXmlPostClass < ActionController::IntegrationTest
test “should successfully post XML” do

Continue reading Testing RESTful Rails controllers by POSTing XML

Five Things I Wish I'd Known About Ruby & Rails

Six months ago, I decided to learn Ruby and the Ruby on Rails framework. It was a whim. I dove in feet-first without spending too much time focusing on studying the language. To force myself to solve real problems, I decided to write a real application. Now, with six months of knowledge, here are the things I had known when I

Continue reading Five Things I Wish I’d Known About Ruby & Rails