Lets say I have the following model:
class Car < ActiveRecord::Base
attr_accessible :wheels,
:engine_cylinders
validates :wheels, :engine_cylinders, presence: true, numericality: true
end
Lets say I then have the following controller action:
@car = Car.find(params[:id])
@car.wheels = "foo"
@car.engine_cylinders = 4
@car.save
This save will fail as wheels will fail the numericality condition.
Is there any way to persist the succesful attributes (in this case engine_cylinders), while adding the invalid attributes to the errors array? E.g. is there a "soft" validation in Rails?
savemechanism by populating theerrorsarray, so any validation which adds something to that array is going to prohibit any subsequent save.