# Model creating a model?

**URL:** <https://www.ruby-forum.com/t/model-creating-a-model/127108>\
**Category:** Rails\
**Created:** [January 25, 2008, 1:00am UTC](https://www.ruby-forum.com/t/model-creating-a-model/127108 "2008-01-25T01:00:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fox](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/c5a1d2/32.png) [@fox](https://www.ruby-forum.com/u/fox)\
**Post date:** [January 25, 2008, 1:00am UTC](https://www.ruby-forum.com/t/model-creating-a-model/127108/1 "2008-01-25T01:00:58Z")

</div>

hi all,  
is it possible for a model to create an object (of which it has many),  
when it is first created?  
i’m trying to have something like

Image -hm-\> ImageThumbs  
where the first ImageThumb is created when the Image object is saved,  
and any validation errors from ImageThumb.validation are passed back to  
the original object/page template.

any thoughts on this?  
thanks for reading.

---

<div class="post-metadata">

**Author:** ![fox](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/c5a1d2/32.png) [@fox](https://www.ruby-forum.com/u/fox)\
**Post date:** [January 25, 2008, 5:31am UTC](https://www.ruby-forum.com/t/model-creating-a-model/127108/2 "2008-01-25T05:31:35Z")

</div>

This is entirely possible using a before\_create, or creating the  
associated  
object along with the original object and using validates\_associated  
:associated\_objects

On Jan 25, 2008 10:30 AM, Fox Ph [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> ## any thoughts on this? thanks for reading.
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Ryan B.

> **[frozenplague.net](http://www.frozenplague.net)**
>
> This domain may be for sale!

Feel free to add me to MSN and/or GTalk as this email.
