p>
def validate
errors.add(:score, '您的积分不够') if (!self.cur_ask_score.nil?) && (self.score > self.cur_ask_score)
end
p>
, that’s the validation in the model.
p>
, I started with
p>
def validate
errors.add(:score, '您的积分不够') if self.score > self.cur_ask_score
end
p>
results in the following error:
p>
p>
comparison of Fixnum with nil failed
p>
just now, I ran into a weird problem — the usual assumption is that saving a successful operation doesn’t work!
p>
this kind of problem, generally is the model validation failure caused by!
p>