Trouble saving current user

I have an application where users can log in and create records. I am trying to get Rails to save the id/name of the user who created the record. Somehow, the user id isn't getting stored, and I can't tell why.

I'm rather new to Rails, and I'm cobbling together different tips from different tutorials (and advice from friendly people here), and my guess is that I've just mushed too much stuff together and don't know how to integrate it all gracefully. Or, just as likely, there's some glaring typo in my code.

In any case, here is the relevant part of the controller:

---------------------words_controller.rb------------------- class WordsController < ApplicationController    before_filter :login_required, :only => [ :new, :create, :edit, :update, :delete ] ....    def new       @word =    end    def create       @modword = (Modword.find_by_modspell(params[:modword][:modspell])


      @word =[:word])       @word =[:word].merge(:modword_id =>         if           redirect_to(:action => :index)         else           render :action => 'new'       end    end .... end

You could also do: