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
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:
class WordsController < ApplicationController
before_filter :login_required, :only => [ :new, :create, :edit,
:update, :delete ]
@word = Word.new
@modword = (Modword.find_by_modspell(params[:modword][:modspell])
@word = @current_user.words.build(params[:word])
@word = Word.new(params[:word].merge(:modword_id => @modword.id))
redirect_to(:action => :index)
render :action => ‘new’
Any idea what’s going on here? If you need more information, I’ll be
happy to supply it!
Thanks so much!