# Class coercion?

**URL:** <https://www.ruby-forum.com/t/class-coercion/109584>\
**Category:** Rails\
**Created:** [July 17, 2007, 2:59am UTC](https://www.ruby-forum.com/t/class-coercion/109584 "2007-07-17T02:59:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jfrankov](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/87869e/32.png) [@jfrankov](https://www.ruby-forum.com/u/jfrankov)\
**Post date:** [July 17, 2007, 2:59am UTC](https://www.ruby-forum.com/t/class-coercion/109584/1 "2007-07-17T02:59:38Z")

</div>

I’m not sure if this is a. possible or b. what I want to do, but I’m  
curious: is it possible to force a Ruby class to become a different  
class? I’m getting this error in my rails app:

ActiveRecord::AssociationTypeMismatch (TagLocality expected, got  
#Class:0x983f5a0):

I’m wondering if there’s some way to take that Class object and  
“magick” it into a TagLocality object, thereby solving my problems and  
creating world peace.

Any ideas or tips are welcome and very appreciated.

Thanks!  
-Jason
