Storing user_id in a form post

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 ?

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs