rails 3 how to automatically post user_id in column of comments
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 th开发者_运维百科e 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
If you are trying to get the current user's ID you can do
current_user.id
in your view or in your controller
精彩评论