Has_many :addresses, :as => :addressable


I just got the Rails Recipies and I’m looking the Recipe 17.

class Person < ActiveRecord::Base
has_many :addresses, :as => :addressable

class Company < ActiveRecord::Base
has_many :addresses, :as => :addressable

class Address < ActiveRecord::Base
belongs_to :addressable, :polymorphic => true

At the beggining I had some problems because “polymorphic” was not
supported on Rails1.0.0 then I update rails. In the console everything
works fine but when I’m trying to list the people I’m getting the
“Unknown key(s): as” error.
Does anyone have a clue of what’s going on?

This is what I have updated

C:\rails>gem update rails --source http://gems.rubyonrails.org
Upgrading installed gems…
Updating Gem source index for: http://gems.rubyonrails.org
Attempting remote upgrade of rails
Attempting remote installation of ‘rails’
Install required dependency activesupport? [Yn] y
Install required dependency activerecord? [Yn] y
Install required dependency actionpack? [Yn] y
Install required dependency actionmailer? [Yn] y
Install required dependency actionwebservice? [Yn] y
Successfully installed rails-
Successfully installed activesupport-
Successfully installed activerecord-
Successfully installed actionpack-
Successfully installed actionmailer-
Successfully installed actionwebservice-
Installing RDoc documentation for activesupport-…
Installing RDoc documentation for activerecord-…
Installing RDoc documentation for actionpack-…
Installing RDoc documentation for actionmailer-…
Installing RDoc documentation for actionwebservice-…
Gems: [rails] updated

C:\rails>rails -v
Rails 1.0.0


tor, 23,.03.2006 kl. 00.24 +0100, skrev Rath:

Seems broken. I get:

NoMethodError: undefined method `create_address’

It’s working great if i’m using:
has_one :address, :as => :addressable