# Storing user\_id in a form post

**URL:** <https://www.ruby-forum.com/t/storing-user-id-in-a-form-post/118488>\
**Category:** Rails\
**Created:** [October 27, 2007, 6:59pm UTC](https://www.ruby-forum.com/t/storing-user-id-in-a-form-post/118488 "2007-10-27T18:59:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chubbs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/47e85d/32.png) [@Chubbs](https://www.ruby-forum.com/u/Chubbs)\
**Post date:** [October 27, 2007, 6:59pm UTC](https://www.ruby-forum.com/t/storing-user-id-in-a-form-post/118488/1 "2007-10-27T18:59:32Z")

</div>

hey guys, got a simple question here new to rails and loving it!

i have form

\<%= form\_tag :action =\> “answer”, :id =\> @question %\>

Body:   
  
\<%= text\_area “answer”, “body” %\>

\<%= submit\_tag ‘Answer’ %\>

and in my controller

def answer

Question.find(params[:id]).question\_answers.create(params[:answer])  
redirect\_to :action =\> “show”, :id =\> params[:id]  
end

its storing the infromation (body, question\_id) but not my user\_id ,  
how could i store it ?

---

<div class="post-metadata">

**Author:** ![Chubbs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/47e85d/32.png) [@Chubbs](https://www.ruby-forum.com/u/Chubbs)\
**Post date:** [October 27, 2007, 11:47pm UTC](https://www.ruby-forum.com/t/storing-user-id-in-a-form-post/118488/2 "2007-10-27T23:47:32Z")

</div>

Before I started writing my applications with a RESTful design, I  
always passed stuff like that in a hidden field.

If you go the RESTful approach, you can configure it so that the  
user\_id will always be part of the request url.

If you have no idea what I mean by RESTful, then I will post back with  
some links to get you going. Let me know.
