Sessions (newbie problem)

hi!

im implementing a login system for a messageboard. tooked from a book.
pretty simple. everythings works great, but in the example the idea is,
when i want to create a new message, the author name shall be tooked
from the session[:user]

def create
params[:message][:date] = Time.now
params[:message][:author_id] = @session[:user].id #here!!

@message = Message.new(params[:message])
if @message.save
  flash[:notice] = 'Message was successfully created.'
  redirect_to :action => 'list'
else
  render :action => 'new'
end

end

but i recive this error:
“Called id for nil, which would mistakenly be 4 – if you really wanted
the id of nil, use object_id”

i dont know why, im following the example step by step. what can i do?

ty!!

fixed!!

in the book was so: @session[:user].id

and i tried with:

@session[‘user’].id

it works

ty anyway! :stuck_out_tongue: