# NoMethodError with my sessions controller?

**URL:** <https://www.ruby-forum.com/t/nomethoderror-with-my-sessions-controller/140416>\
**Category:** Rails\
**Created:** [June 13, 2008, 6:13pm UTC](https://www.ruby-forum.com/t/nomethoderror-with-my-sessions-controller/140416 "2008-06-13T18:13:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dezrtdude](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f4b2a3/32.png) [@dezrtdude](https://www.ruby-forum.com/u/dezrtdude)\
**Post date:** [June 13, 2008, 6:13pm UTC](https://www.ruby-forum.com/t/nomethoderror-with-my-sessions-controller/140416/1 "2008-06-13T18:13:55Z")

</div>

Hi All,

Can someone please explain the meaning of the following error:

“NoMethodError (undefined method `+’ for  
{:action=\>“new”, :controller=\>“sessions”}:Hash):”

I have 3 controllers: TEAM, USER, SESSION

If I create a single user from TEAM it works fine, however if I  
perform a loop to create multiple USERs, I get the above error. It  
makes no sense. The USER model does validation but I make sure that  
each iteration changes the specific value. What’s more is I can do it  
manually and it works fine. Why would a loop cause the app to flip  
out?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![dezrtdude](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f4b2a3/32.png) [@dezrtdude](https://www.ruby-forum.com/u/dezrtdude)\
**Post date:** [June 13, 2008, 6:19pm UTC](https://www.ruby-forum.com/t/nomethoderror-with-my-sessions-controller/140416/2 "2008-06-13T18:19:48Z")

</div>

On Jun 13, 5:13 pm, gberz3 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi All,
> 
> Can someone please explain the meaning of the following error:
> 
> “NoMethodError (undefined method `+’ for  
> {:action=\>“new”, :controller=\>“sessions”}:Hash):”

You called + on something which doesn’t understand +. Hard to say  
what’s wrong without seeing what you’ve actually done

Fred

---

<div class="post-metadata">

**Author:** ![dezrtdude](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f4b2a3/32.png) [@dezrtdude](https://www.ruby-forum.com/u/dezrtdude)\
**Post date:** [June 13, 2008, 6:29pm UTC](https://www.ruby-forum.com/t/nomethoderror-with-my-sessions-controller/140416/3 "2008-06-13T18:29:49Z")

</div>

First of all, wow. That was a fast postback. Thank you.

I actually _just_ found the problem. I was assigning the following:

cur\_name = (teamname.to\_s + j.to\_s).to\_s  
cur\_email = curname + “@na.com”

…notice the missing underscore in the second assignment. Ruby of  
course assigned the value to a hash and then thing went awry. Of  
course, it _really_ would have been nice to have a more intuitive  
error statement.

Thanks again!

On Jun 13, 12:19 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
