I have a Car model which i want to check and discard record before it's saved ,if it not pass the condition from method the code is look like this :
class Car < ActiveRecord::Base
after_save :wheel_not_zero
def wheel_not_zero
false if self.wheel_num == 0
end
end
by this solution it'll reject all of car that user send from the form with error and redirect to form again. I want to reject only car which match a condition with out redirect to form again.
I create car record via nested attribute from member model the relation is look like this
member -> car
,so I want to save member record and not matched condition cars record, right now it's reject all records.
thank you for all response :)