Forum: Ruby on Rails has_many :addresses, :as => :addressable

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3e3e9c160cf5f5f9a6522626275136ce?d=identicon&s=25 Rath -. (rath)
on 2006-03-23 00:24
I just got the Rails Recipies and I'm looking the Recipe 17.

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

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

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

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-1.0.0.4008
Successfully installed activesupport-1.2.5.4008
Successfully installed activerecord-1.13.2.4008
Successfully installed actionpack-1.11.2.4008
Successfully installed actionmailer-1.1.5.4008
Successfully installed actionwebservice-1.0.0.4008
Installing RDoc documentation for activesupport-1.2.5.4008...
Installing RDoc documentation for activerecord-1.13.2.4008...
Installing RDoc documentation for actionpack-1.11.2.4008...
Installing RDoc documentation for actionmailer-1.1.5.4008...
Installing RDoc documentation for actionwebservice-1.0.0.4008...
Gems: [rails] updated

C:\rails>rails -v
Rails 1.0.0
Runar Ingebrigtsen (Guest)
on 2006-03-23 14:47
(Received via mailing list)
tor, 23,.03.2006 kl. 00.24 +0100, skrev Rath:
> end
Seems broken. I get:
>> Company.find(1).create_address
NoMethodError: undefined method `create_address'

It's working great if i'm using:
	has_one :address, :as => :addressable
This topic is locked and can not be replied to.