I have a form that send an AJAX request to the controller, the action
instantiate an object so I could send data back to the view, but every
I hit the action the variable reset is there a way to avoid this
This is my code inside my SaleController :
@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+/)
@sale = Sale.new
@sale.line_items << @line_item
What I want is @sale not to be reset every time I hit the action, I
about @sale ||= Sale.new but that didn’t work.
Any help would be appreciated.