# Saving record and it's association

**URL:** <https://www.ruby-forum.com/t/saving-record-and-its-association/142218>\
**Category:** Rails\
**Created:** [July 4, 2008, 6:13pm UTC](https://www.ruby-forum.com/t/saving-record-and-its-association/142218 "2008-07-04T18:13:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tarscher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@Tarscher](https://www.ruby-forum.com/u/Tarscher)\
**Post date:** [July 4, 2008, 6:13pm UTC](https://www.ruby-forum.com/t/saving-record-and-its-association/142218/1 "2008-07-04T18:13:50Z")

</div>

Hi all,

I have a user that has one activation.

When a user is created I want to generate an activation key

I tried in the create usercontroller  
@user = User.new(params[:user])  
@user.activation \<\< Activation.new()

I get:  
You have a nil object when you didn’t expect it!  
You might have expected an instance of Array.  
The error occurred while evaluating nil.\<\<

I want to save the user and it’s association (activation). How can I  
do this?

thanks  
Stijn

---

<div class="post-metadata">

**Author:** ![Tarscher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@Tarscher](https://www.ruby-forum.com/u/Tarscher)\
**Post date:** [July 4, 2008, 6:20pm UTC](https://www.ruby-forum.com/t/saving-record-and-its-association/142218/2 "2008-07-04T18:20:17Z")

</div>

On 4 Jul 2008, at 17:13, Tarscher wrote:

> I get:  
> You have a nil object when you didn’t expect it!  
> You might have expected an instance of Array.  
> The error occurred while evaluating nil.\<\<
> 
> I want to save the user and it’s association (activation). How can I

Assuming activation is a singular association (ie not a has many) then  
you should be using = not \<\<

Fred
