Tell us what you really think

Posted by Rick DeNatale Thu, 20 Sep 2007 13:20:00 GMT

Obie Fernandez just went off about Java vs. Ruby/Rails.

No time to comment, read it for yourself.

Posted in ,  | Tags  | 1 comment | no trackbacks

Conventions Uber Alles

Posted by Rick DeNatale Tue, 11 Sep 2007 23:24:00 GMT

One of the Rails mantras is “Convention over configuration.” Today I bumped up against that one in spades.

Being an agile sort of guy, I tend to make frequent small refactorings, ofen this involves renaming things. I’m working on a project which will involve talking to a remote legacy database. I’m building migrations to set up a local development database which mirrors the schema of this database. I’d already generated a migration, and while working on it decided that it needed to be renamed. So I changed it to something like “007_create_LEG_Frammis_table.rb” since the legacy table had the name (changed to protect the guilty) of LEG_Frammis.

I was shocked when I ran rake db:migrate only to find that rake blew up. Turning on the—trace option to rake showed that it wasn’t even getting to my migration code. Instead some code in vendor/rails/activerecord/lib/active_record/migration.rb was getting an unexpected nil and trying to send the message first to it.

A quick look at the code didn’t reveal an obvious reason, so I broke out ruby-debug and ran rake under rdebug.

It turns out that rails REALLY expects migration names to match the regular expression /([0-9]+)_([_a-z0-9]*).rb/, those uppercase characters were the culprits.

Update

The patch, which Ben mentioned that he submitted in his comment, has been turned down because it would violate the assumption that round trips can be made between class names and file names.

Posted in  | 1 comment | no trackbacks

Conventions Uber Alles

Posted by Rick DeNatale Tue, 11 Sep 2007 23:24:00 GMT

One of the Rails mantras is “Convention over configuration.” Today I bumped up against that one in spades.

Being an agile sort of guy, I tend to make frequent small refactorings, ofen this involves renaming things. I’m working on a project which will involve talking to a remote legacy database. I’m building migrations to set up a local development database which mirrors the schema of this database. I’d already generated a migration, and while working on it decided that it needed to be renamed. So I changed it to something like “007_create_LEG_Frammis_table.rb” since the legacy table had the name (changed to protect the guilty) of LEG_Frammis.

I was shocked when I ran rake db:migrate only to find that rake blew up. Turning on the—trace option to rake showed that it wasn’t even getting to my migration code. Instead some code in vendor/rails/activerecord/lib/active_record/migration.rb was getting an unexpected nil and trying to send the message first to it.

A quick look at the code didn’t reveal an obvious reason, so I broke out ruby-debug and ran rake under rdebug.

It turns out that rails REALLY expects migration names to match the regular expression /([0-9]+)_([_a-z0-9]*).rb/, those uppercase characters were the culprits.

Update

The patch, which Ben mentioned that he submitted in his comment, has been turned down because it would violate the assumption that round trips can be made between class names and file names.

Posted in  | 1 comment | no trackbacks

How to Cure The PayPal Subscription Blues

Posted by Rick DeNatale Mon, 03 Sep 2007 01:08:00 GMT

Some months back, I got the opportunity to work on an existing web site, implemented in Rails, which uses PayPal subscriptions to control access.

Since them, I’ve learned more about PayPal subscriptions than I cared to. Today’s revelation on Slashdot of the latest paypal subscription glitch prompts me to share a bit of this hard-earned knowledge. Read more...

Posted in  | Tags ,  | no comments | no trackbacks

After the Hoedown is Over, Part 1

Posted by Rick DeNatale Tue, 14 Aug 2007 15:03:00 GMT

The first Ruby Hoedown, sponsored by the Raleigh Ruby brigade, has finally come and gone. I had a great two days, saw some old friends, and made lots of new ones.

Here are my initial thoughts after more than a bit too litle sleep after a night trying to root out werewolves.

Read more...

Posted in , , ,  | Tags ,  | no comments | no trackbacks

It Might Not be Written in Ruby but...

Posted by Rick DeNatale Fri, 03 Aug 2007 00:11:00 GMT

This looks interesting.

I wish I had a nickel for every time I’ve typed something like:

grep whatever -R . | grep -v .svn

Posted in ,  | Tags , ,  | 1 comment | no trackbacks

Keeping it up (Your Rails App that is)

Posted by Rick DeNatale Thu, 02 Aug 2007 16:23:00 GMT

I live in the fastest growing corner of one of the fastest growing counties in the US. Lately that has seemed to come with more than my share of power interruptions.

This blog is hosted on a ‘server’ in my home office, which also hosts several other things, some for internal use, and others, like talklikeaduck are public facing. Besides this blog I have a wikimedia based site on the technical history of Project Mercury, a personal interest of mine.

One of my frustrations of late has been the fact that the blog doesn’t suffer those power interruptions well. For deployment, I’m using a combination of Apache 2.0, with pen for load balancing, and mongrel_cluster. That last has been the main source of that minor annoyance. The version of mongrel_cluster I’ve been using doesn’t properly deal with stale pid files, so that when the system reboots after a power outage, the blog doesn’t come back without manual intervention.

My frustration level finally rose to the point where I started to look for a solution.

Read more...

Posted in  | Tags , , , , ,  | 1 comment | no trackbacks

How Fast Can You Make YOUR Rails App Go?

Posted by Rick DeNatale Fri, 20 Jul 2007 02:49:00 GMT

Charlie Savage just posted a long article about how he reduced the rendering time on his rails app by an order of magnitude.

The article is full of advice on what to do and not to do in coding rails apps. The important message though is the approach to performance tuning by profiling.

t

Posted in  | Tags  | no comments | no trackbacks

Do You Ever Have Those Kind of Days?

Posted by Rick DeNatale Thu, 19 Jul 2007 18:19:00 GMT

Yesterday I wrote about some code I wrote to control what Time.now and Date.today return to support time-dependent testing.

This afternoon I discovered a critical, but easy to fix bug. I’ve updated the original article.

The good news is that the testcase for the time machine now has another test!

Posted in  | Tags , ,  | no comments | no trackbacks

Time Flies While You're Having Fun Testing

Posted by Rick DeNatale Wed, 18 Jul 2007 19:45:00 GMT

I’ve been working on adding support for localization of the user’s time zone on an existing Rails app for a client. In order to test this, I found myself building a time machine.

At first, I did a fairly simple hack which monkey patched the system methods Time.now, and Date.today. This worked until I got into some testcases of code which was triggered off of updated_at fields in various ActiveRecord models. Since I had to deal with these implicit dates, I found that I needed to have finer control than my simple patch gave.

The code has now evolved to the point where I think that it shows some interesting aspects of basic Ruby metaprogramming.

Read more...

Posted in ,  | Tags ,  | 1 comment | 1 trackback

Older posts: 1 2 3