Archive for April, 2007

links for 2007-04-12

Wednesday, April 11th, 2007

Excellent REST Tutorial Series

Tuesday, April 10th, 2007

Softies on Rails is posting an excellent REST tutorial series. They are doing a great job in describing how a web application is just a collection of resources (and not necessarily web pages), and how you can think of your web application as the gateway to manipulate those resources. If you want to learn REST, and good web architecture, this tutorial series is the way to start.

This reminds me of the great “A resource is a web page about your car, not your car itself” debate.

Norm Walsh sums this debate up nicely:


Suffice it to say that some folks think http://example.org/some/path must identify “a document” (what the AWWW calls an “information resource”) and some folks think it can identify anything at all.

In any case, thinking of your web application as a collection of resources is the way to go. You don’t usually need to get all carried away with “what is a resource?” unless you are trying to model knowledge, but that’s another story

Ruby on Rails Mangles Decimal Type to Integer

Monday, April 9th, 2007

So when is a DECIMAL not a DECIMAL? Go ahead, take your time. I’ll wait.

A decimal type is converted to an integer by Ruby on Rails through its infinite wisdom. As seen in active\_record\connection\_adapters\abstract\schema\_definitions.rb, line 180 (in Rails 1.2.3):

when /decimal|numeric|number/i
extract_scale(field_type) == 0 ? :integer : :decimal

So, apparently, Rails thinks, “Well, I know you specified a decimal type, but hey, you didn’t specify a scale, so you must have made a typo! Here, let me just change that to integer for you.”

Or, in other words:

You: I’d like a hamburger with nothing on it.

Rails: OK, here’s your hot dog.

You: WTF??!?

Apparently, this issue has been reported before. However, as of Version 1.2.3 of Rails, this issue still exists.

I’ve just opened a new issue on the Rails Trac site. You can see if any of the core developers will see why converting a decimal to an integer is completely counter intuitive.

links for 2007-04-07

Friday, April 6th, 2007

links for 2007-04-06

Thursday, April 5th, 2007

links for 2007-04-03

Monday, April 2nd, 2007