rieles 3 cómo publicar automáticamente user_id en la columna de comentarios

im totally new to rails. here my question:

i made an app with articles and comments and use devise for authentication

sadly im only able to post 1 hyperlink so this is the middle part of my post with the files at gist: https://gist.github.com/771366

the article_id is pre selected in the comments/_form - but the user_id isnt. i googled a lot, tried value => session[:user_id] and others, but nothing worked

would be great if someone could tell me how it works ^^

tHX

preguntado el 09 de enero de 11 a las 02:01

1 Respuestas

If you are trying to get the current user's ID you can do

current_user.id

in your view or in your controller

Respondido el 09 de enero de 11 a las 05:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.