初始化为假红宝石

时间:2015-11-06 03:34:58

标签: ruby-on-rails ruby

我试图在每个故障单创建后将其初始化为false,但我不知道该怎么做

  def addToTicket
  ticket = Ticket.find_by(table: session[:table_id])
  if (ticket.nil?) || (ticket.tstatus == 9)
    ticket = Ticket.create(table: session[:table_id], tax: 0, tstatus: 0 )  

    session[:ticket] = ticket
    puts("**********Ticket created************")
  end
     ticket.orderItems.create(
            item: (Menuitem.find_by(name: params[:item_name]).id),
            ingredients: params[:good_ingredients],
            notes: params[:notes],
            istatus: 0
        )
        session[:ticket] = ticket
        puts("**************Ticket added to***********")
        calcTotal
        redirect_to guest_path

end

1 个答案:

答案 0 :(得分:0)

session[:tickets] = {}
session[:tickets][ticket] = false