Forum: Ruby on Rails Attaching user to comment

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Abed21abff74d51f99d8ae6ad8e5a3e9?d=identicon&s=25 (Guest)
on 2007-05-18 01:35
(Received via mailing list)
How would I add a user name along with the form input? The user name
is defined in application.rb as @current_user

Below works 100% w/ adding the comment body/time but I wasnt sure how
to add the user part


def comment
@albums = Albums.find(params[:id])
@albumscomment =
    if and
    flash[:notice] = 'comment submission succeeded!'
    redirect_to :action => 'show', :permalink => @albums.permalink
This topic is locked and can not be replied to.