core/app/controllers/admin/products_controller.rb
def destroy
    @product = Product.find_by_permalink(params[:id])
    @product.deleted_at = Time.now()

    @product.variants.each do |v|
      v.deleted_at = Time.now()
      v.save
    end

    if @product.save
      flash.notice = I18n.t("notice_messages.product_deleted")
    else
      flash.notice = I18n.t("notice_messages.product_not_deleted")
    end

    respond_to do |format|
      format.html { redirect_to collection_url }
      format.js  { render_js_for_destroy }
    end
  end
# override the destory method to set deleted_at value
# instead of actually deleting the product.
override the destory method to set deleted_at value
instead of actually deleting the product.
override the destory method to set deleted_at value instead of actually deleting the product .
def destroy
    @product = Product.find_by_permalink(params[:id])
    @product.deleted_at = Time.now()
    @product.variants.each do |v|
      v.deleted_at = Time.now()
      v.save
    end
    if @product.save
      flash.notice = I18n.t("notice_messages.product_deleted")
    else
      flash.notice = I18n.t("notice_messages.product_not_deleted")
    end
    respond_to do |format|
      format.html { redirect_to collection_url }
      format.js  { render_js_for_destroy }
    end
  end
def destroy @product = Product . find_by_permalink ( params [ :id ] ) @product . deleted_at = Time . now ( ) @product . variants . each do | v | v . deleted_at = Time . now ( ) v . save end if @product . save flash . notice = I18n . t ( "notice_messages.product_deleted" ) else flash . notice = I18n . t ( "notice_messages.product_not_deleted" ) end respond_to do | format | format . html { redirect_to collection_url } format . js { render_js_for_destroy } end end
override the destory method to set deleted_at value
instead of actually deleting the product.
override the destory method to set deleted_at value instead of actually deleting the product .