So, all the documentation says I should be able to call #create! on an
ActiveRecord, to do the same thing as #create, but raise an exception on
validation failure.
But when I try this on any ActiveRecord::Base class, I seem to get an
exception raised with method_missing, saying there’s no create! method.
Am I missing something?
Jonathan R. wrote:
So, all the documentation says I should be able to call #create! on an
ActiveRecord, to do the same thing as #create, but raise an exception on
validation failure.
But when I try this on any ActiveRecord::Base class, I seem to get an
exception raised with method_missing, saying there’s no create! method.
Am I missing something?
Hey,
I have always used #save instead of #save!, and still can catch those
validation errors!