I have a form that send an AJAX request to the controller, the action just instantiate an object so I could send data back to the view, but every time I hit the action the variable reset is there a way to avoid this behaviour. This is my code inside my SaleController : def getquote @line_item = LineItem.new( params.require(:line_item).permit(:project_name, :pages, :quantity, :paper_id, :product_id, :plastic_id, :discount, :quote_before_discount, :duplex, :cost, :width, :height, :extras) ) @number = params[:index].match(/\d+/)[0] @sale = Sale.new @sale.line_items << @line_item end What I want is @sale not to be reset every time I hit the action, I thought about @sale ||= Sale.new but that didn't work. Any help would be appreciated. Thanks. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a8e82164-bae0-48eb-8020-1c9834c19d25%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.