# Has\_many :through doesn't work with .new()?

**URL:** <https://www.ruby-forum.com/t/has-many-through-doesnt-work-with-new/144998>\
**Category:** Rails\
**Created:** [August 5, 2008, 1:48am UTC](https://www.ruby-forum.com/t/has-many-through-doesnt-work-with-new/144998 "2008-08-05T01:48:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![morgan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@morgan](https://www.ruby-forum.com/u/morgan)\
**Post date:** [August 5, 2008, 1:48am UTC](https://www.ruby-forum.com/t/has-many-through-doesnt-work-with-new/144998/1 "2008-08-05T01:48:09Z")

</div>

so thingys is related to middles which is related to users

```
@wamp = Thingy.new
@wamp.wonko = 13
@wamp.save

```

this is the has many relationship in the thingy model.

has\_many :wonko, :through =\> :middles, :source =\> :user

i just keep getting a undefined method wonko.

even though when i pull thingys from the database it has no problem  
getting the user related to the thingys… i’m lost.

---

<div class="post-metadata">

**Author:** ![morgan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@morgan](https://www.ruby-forum.com/u/morgan)\
**Post date:** [August 5, 2008, 2:33am UTC](https://www.ruby-forum.com/t/has-many-through-doesnt-work-with-new/144998/2 "2008-08-05T02:33:31Z")

</div>

On Aug 5, 12:48 am, Morgan M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> so thingys is related to middles which is related to users
> 
> ```
> @wamp = Thingy.new
> @wamp.wonko = 13
> @wamp.save
> 
> ```
> 
> this is the has many relationship in the thingy model.
> 
> has\_many :wonko, :through =\> :middles, :source =\> :user

It would be helpful to see the actual code, and real examples (eg  
@wamp.wonko= 13 could never ever work) and the actual error/stack  
trace

Fred
