lib/freeform/form.rb in freeform-0.0.3.rc3 vs lib/freeform/form.rb in freeform-0.0.3.rc4

- old
+ new

@@ -5,10 +5,11 @@ require 'freeform/form/nested' require 'freeform/form/property' require 'freeform/form/validation' module FreeForm + class FormInvalid < StandardError; end class Form extend Forwardable extend ActiveModel::Naming extend ActiveModel::Callbacks include ActiveModel::Conversion @@ -44,10 +45,10 @@ end return true end def save! - raise StandardError, "form invalid." unless valid? + raise FreeForm::FormInvalid, "form invalid." unless valid? self.class.models.each do |form_model| if send(form_model).is_a?(Array) send(form_model).each { |model| model.save! } else if marked_for_destruction? \ No newline at end of file