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.
On Oct 27, 2007, at 12:58 PM, Chubbs wrote:
>
> hey guys, got a simple question here new to rails and loving it!
>
> i have form
>
> <%= form_tag :action => "answer", :id => @question %>
>
> Body: <br/>
> <%= text_area "answer", "body" %><br/>
>
> <%= submit_tag ''Answer'' %>
> </form>
>
>
> 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 ?
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---