self.eligibility_for_rebate = decide_eligibility end def ensure_credit_card_is_on_file puts "check if credit card is on file" end end Order.create! => ActiveRecord::RecordNotSaved: ActiveRecord::RecordNotSaved
self.eligibility_for_rebate = decide_eligibility end def ensure_credit_card_is_on_file puts "check if credit card is on file" end end Order.create! => check if credit card is on file => <Order id: 4, eligibility_for_rebate: false>
self.eligibility_for_rebate = decide_eligibility throw(:abort) end def ensure_credit_card_is_on_file puts "check if credit card is on file" end end Order.create! => ActiveRecord::RecordNotSaved: Failed to save the record
be removed in Rails 5.1, as `ActionController::Parameters` no longer inherits from hash. Using this deprecated behavior exposes potential security problems. If you continue to use this method you may be creating a security vulnerability in your app that can be exploited. Instead, consider using one of these documented methods which are not deprecated: http://api.rubyonrails.org/v5.0.0/classes/ActionController/ Parameters.html