Set table value

Hi guys,

I'm a newbie in ruby and I would just like to know how you set a value
for a field in a table where session[:user_id] matches user.user_id.

I am trying to do this from a submit form in the show.html.erb file
because that is where the other field value is set.

Help would be much appreciated..

  <%=h @post.title %>

  <%=h @post.mood %>

  <%=h @post.location %>

  <%=h @post.thoughts %>

  <% @post.comments.each do |comment| %>

    <%= h comment.comment %><br/>
    <div class = "dateline">
        Posted on <%= comment.created_at.strftime("%B %d, %Y at %I:%M

  <% end %>

<% form_for(:comment, :url => post_comments_path(@post)) do |f| %>
   <%= f.text_area :comment %></p>
   <%= comment.username.set("User.find_by_id(session[:user_id]).name")
   <%= f.submit "Create" %>
<%end %>

<%= link_to 'Edit', edit_post_path(@post) %> |
<%= link_to 'Back', posts_path %>

If I've understood you properly you're doing this back to front. You'd
typically do this in the comments controller, when you are creating
the new comment

is no user.user_id