# Polymorphic associations

**URL:** <https://www.ruby-forum.com/t/polymorphic-associations/55800>\
**Category:** Rails\
**Created:** [March 23, 2006, 10:21pm UTC](https://www.ruby-forum.com/t/polymorphic-associations/55800 "2006-03-23T22:21:31Z")\
**Posts on this page:** 6\
**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, 10:21pm UTC](https://www.ruby-forum.com/t/polymorphic-associations/55800/1 "2006-03-23T22:21:31Z")

</div>

I have just updated rails and added polymorphic associations but they  
are not working properly. I’m following the recipe 17 of “Rails Recipes”  
and I’m getting an “Unknown key(s): as” error. These associations work  
properly on the console. The problem occurs when I’m listing the  
items… perhaps the problem is pagination. Is this a bug or what should  
I do?

Here is the log:  
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active\_support/core\_ext/hash/keys.rb:48:in  
`assert_valid_keys' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/associations.rb:438:in`has\_one\_without\_reflection’  
(eval):5:in `has_one' #{RAILS_ROOT}/app/models/person.rb:4 #{RAILS_ROOT}/app/controllers/company_controller.rb:7:in`list’  
-e:3

---

<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, 11:39pm UTC](https://www.ruby-forum.com/t/polymorphic-associations/55800/2 "2006-03-23T23:39:04Z")

</div>

I think, it is working after all. I had to restart the computer and that  
was all… perhaps the old sessions were there. I have seen somewhere a  
script to remove old sessions, does anyone knows that script?

Thanks

---

<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 24, 2006, 1:39am UTC](https://www.ruby-forum.com/t/polymorphic-associations/55800/3 "2006-03-24T01:39:01Z")

</div>

Rath wrote:

> I think, it is working after all. I had to restart the computer and that  
> was all… perhaps the old sessions were there. I have seen somewhere a  
> script to remove old sessions, does anyone knows that script?

I don’t know about a script - from your previous post it appears you are  
on Windows, so your session files should be in:

C:\Documents and Settings\YourUserName\Local Settings\Temp

with names of the form:

ruby\_sess.5e85a819a49ed1c2

…just delete those files.

regards

Justin

---

<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 24, 2006, 3:26am UTC](https://www.ruby-forum.com/t/polymorphic-associations/55800/4 "2006-03-24T03:26:05Z")

</div>

On 3/23/06, Rath [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I think, it is working after all. I had to restart the computer and that  
> was all… perhaps the old sessions were there. I have seen somewhere a  
> script to remove old sessions, does anyone knows that script?
> 
> Thanks

You have to restart your app when the rails framework has been updated.

–  
Rick O.  
[http://techno-weenie.net](http://techno-weenie.net)

---

<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 28, 2006, 3:43am UTC](https://www.ruby-forum.com/t/polymorphic-associations/55800/5 "2006-03-28T03:43:21Z")

</div>

Thanks guys

It was just that, I restarted my computer and everything worked fine. I  
tried removing the session files and didn’t work at the begining.

Rick O. wrote:

> On 3/23/06, Rath [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > I think, it is working after all. I had to restart the computer and that  
> > was all… perhaps the old sessions were there. I have seen somewhere a  
> > script to remove old sessions, does anyone knows that script?
> > 
> > Thanks
> 
> You have to restart your app when the rails framework has been updated.
> 
> –  
> Rick O.  
> [http://techno-weenie.net](http://techno-weenie.net)

---

<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 28, 2006, 8:57am UTC](https://www.ruby-forum.com/t/polymorphic-associations/55800/6 "2006-03-28T08:57:50Z")

</div>

Rath wrote:

> Thanks guys
> 
> It was just that, I restarted my computer and everything worked fine. I  
> tried removing the session files and didn’t work at the begining.  
> Which OS are you using? You shouldn’t need to restart the whole  
> machine, just the app…
