# Expected, got Fixnum problem

**URL:** <https://www.ruby-forum.com/t/expected-got-fixnum-problem/61965>\
**Category:** Rails\
**Created:** [May 30, 2006, 10:19am UTC](https://www.ruby-forum.com/t/expected-got-fixnum-problem/61965 "2006-05-30T10:19:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![samonderous](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3da27b/32.png) [@samonderous](https://www.ruby-forum.com/u/samonderous)\
**Post date:** [May 30, 2006, 10:19am UTC](https://www.ruby-forum.com/t/expected-got-fixnum-problem/61965/1 "2006-05-30T10:19:49Z")

</div>

Hi,

I was wondering if anybody knew what ’ expected, got Fixnum’  
means? My code looks like the following:

begin  
anevent = Event.new  
anevent.title = params[“event”][“title”]  
anevent = session[:user\_id]  
com = Community.find(params[:id])  
com.events \<\< anevent  
rescue Exception =\> exc  
…  
end

But I get an exception.

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![samonderous](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3da27b/32.png) [@samonderous](https://www.ruby-forum.com/u/samonderous)\
**Post date:** [May 30, 2006, 11:17am UTC](https://www.ruby-forum.com/t/expected-got-fixnum-problem/61965/2 "2006-05-30T11:17:50Z")

</div>

> ```
> anevent = Event.new
> 
> ```

\<…\>

> ```
> anevent = session[:user_id]
> 
> ```

Is this what you really want?

## Regards, Rimantas

[http://rimantas.com/](http://rimantas.com/)

---

<div class="post-metadata">

**Author:** ![samonderous](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3da27b/32.png) [@samonderous](https://www.ruby-forum.com/u/samonderous)\
**Post date:** [May 30, 2006, 11:24am UTC](https://www.ruby-forum.com/t/expected-got-fixnum-problem/61965/3 "2006-05-30T11:24:17Z")

</div>

expected, got Fixnum: that means that you try to assign a  
fixnum  
(an integer…) into something else, and it is not possible to cast the  
fixnum into that something (okay, I’m not sure this helps, I find the  
error  
quite clear if you read it)

Your line:  
anevent = session[:user\_id]  
is suspicious. You try to assign session[:user\_id] to anevent, and  
there’s  
probably no way you can cast a Fixnum into an Event object,

---

<div class="post-metadata">

**Author:** ![samonderous](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3da27b/32.png) [@samonderous](https://www.ruby-forum.com/u/samonderous)\
**Post date:** [May 30, 2006, 11:27am UTC](https://www.ruby-forum.com/t/expected-got-fixnum-problem/61965/4 "2006-05-30T11:27:24Z")

</div>

ah, missed that. sorry and thanks.

saureen.
