ruby - Sequel: Why isn't the save method saving? -
i must missing super simple here. in rspec code below, sec assertion failing, 1 code should have been set true:
describe "#redeem!" "marks code redeemed" existing_code = lotterycode[promo_code: "a5"] existing_code.is_redeemed.should == false existing_code.redeem! changed_code = lotterycode[promo_code: "a5"] changed_code.is_redeemed.should == true end end
here model code:
require 'sequel' class lotterycode < sequel::model many_to_one :campus def redeem! is_redeemed = true save end end
what doing wrong?
you want self.is_redeemed = true
, current code creates local variable.
ruby sequel
No comments:
Post a Comment