# Has\_many :addresses, :as =\> :addressable

**URL:** <https://www.ruby-forum.com/t/has-many-addresses-as-addressable/55692>\
**Category:** Rails\
**Created:** [March 23, 2006, 12:24am UTC](https://www.ruby-forum.com/t/has-many-addresses-as-addressable/55692 "2006-03-23T00:24:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c2a13f/32.png) [@rath](https://www.ruby-forum.com/u/rath)\
**Post date:** [March 23, 2006, 12:24am UTC](https://www.ruby-forum.com/t/has-many-addresses-as-addressable/55692/1 "2006-03-23T00:24:41Z")

</div>

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](http://gems.rubyonrails.org)  
Upgrading installed gems…  
Updating Gem source index for: [http://gems.rubyonrails.org](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

---

<div class="post-metadata">

**Author:** ![rath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c2a13f/32.png) [@rath](https://www.ruby-forum.com/u/rath)\
**Post date:** [March 23, 2006, 2:47pm UTC](https://www.ruby-forum.com/t/has-many-addresses-as-addressable/55692/2 "2006-03-23T14:47:21Z")

</div>

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
