Need help with sessions


I have to store id information from items table and send it to the
notes edit.

So I have link

<%= link_to “note”, :controller => “notes” , :action => “new”, :id
=>@item %>
this should send only id from item table here is the action from items

def edit
@categories = Category.find(:all)
@item = Item.find(params[:id])

Controller from notes is

def new
session[:item_id] = @params[:id]
@note =

respond_to do |format|
  format.html # new.html.erb
  format.xml  { render :xml => @note }


I haven’t found solution for the error :

You have a nil object when you didn’t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]

Should i change session[:item_id] = @params[:id] TO session[:item_id]
= @item

def new
session[:item_id] = @params[:id]
@note =

Not entirely sure what you;re doing, but @params doesn’t exist any
more. It’s just params.


That was the error, thanks for help…

On 4 heinä, 10:21, Frederick C. [email protected]