# Polymorphic belongs\_to

**URL:** <https://www.ruby-forum.com/t/polymorphic-belongs-to/176563>\
**Category:** Rails\
**Created:** [October 2, 2009, 7:13am UTC](https://www.ruby-forum.com/t/polymorphic-belongs-to/176563 "2009-10-02T07:13:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thelemcke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/97f17d/32.png) [@thelemcke](https://www.ruby-forum.com/u/thelemcke)\
**Post date:** [October 2, 2009, 7:13am UTC](https://www.ruby-forum.com/t/polymorphic-belongs-to/176563/1 "2009-10-02T07:13:58Z")

</div>

I am creating an appointment system where appointments can be made for  
current users or for non-registered users. I need a way to create a  
appointment that references a client with polymorphic association. I  
use a PlaceholderUser object to create a placeholder user that just  
has a name, and no other functionality.

I have:  
Appointment  
appt\_time  
client\_id  
client\_type

User  
name  
other attributes

PlaceholderUser  
name

I want to be able to use @appointment.client and @appointment.client=  
to assign a client as either an User or a PlaceholderUser. Is there a  
way to do this without defining ‘client’ and ‘client=’ as class  
methods?
