使用方法的数据未保存在数据库中

时间:2014-08-04 03:37:11

标签: ruby-on-rails ruby-on-rails-3

我想使用@reload.status = boolean(true或false),但我无法将布尔值保存到数据库中。

另外,我一直这样做,但现在不行。

  def return
   ret = ActiveMerchant::Billing::Integrations::Ipay88::Notification.new(request.raw_post)
   if ret.success?
     @reload = Reload.find(ret.item_id)
     @reload.status = true
     @reload.save
     redirect_to new_reload_path, notice: "Success"
   else
     @reload = Reload.find(ret.item_id)
     @reload.status = false
     redirect_to new_reload_path, notice: 'Reload unsuccessful'
   end
  end

1 个答案:

答案 0 :(得分:1)

我忘了为' false'添加@ reload.save声明。 (就像你在" ret.success中看到的那样?"方法调用)

相关问题