Hi
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 controller
def edit @categories = Category.find(:all) @item = Item.find(params[:id]) end
Controller from notes is
def new session[:item_id] = @params[:id] @note = Note.new
respond_to do |format| format.html # new.html.erb format.xml { render :xml => @note } end end
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