# Switched to a has\_many :through, now User can't be blank error

**URL:** <https://www.ruby-forum.com/t/switched-to-a-has-many-through-now-user-cant-be-blank-error/185983>\
**Category:** Rails\
**Created:** [March 30, 2010, 4:22am UTC](https://www.ruby-forum.com/t/switched-to-a-has-many-through-now-user-cant-be-blank-error/185983 "2010-03-30T04:22:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![GoodGets](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/439d5e/32.png) [@GoodGets](https://www.ruby-forum.com/u/GoodGets)\
**Post date:** [March 30, 2010, 4:22am UTC](https://www.ruby-forum.com/t/switched-to-a-has-many-through-now-user-cant-be-blank-error/185983/1 "2010-03-30T04:22:40Z")

</div>

I just changed from a normal has\_many :blogs, belongs\_to :user  
relationship to a has\_many through relationship. I created a new  
model (subscription) and belongs\_to’d it both blog and user, and set  
up their has\_many :subscriptions and their respective through  
association. However, now when I go to create a new blog, I keep  
getting a “User can’t be blank” error. In my blog’s create action,  
I’m doing:

current\_user.blogs.create

Is that the problem? Somehow the current\_user’s id isn’t matching up  
to the user\_id column in the subscriptions model? It mapped correctly  
before. I thought I might not have to pass in the current user, so I  
tried:

Blog.create

but I got the same error, “User can’t be blank”.  
I then thought maybe I had to allow its attr\_accessible for some  
strange reason, but still no dice. What am I doing wrong?  
Big thanks in advance.
