lib/approval/models/approval/request_form/base.rb in approval-0.3.0 vs lib/approval/models/approval/request_form/base.rb in approval-0.3.1
- old
+ new
@@ -25,9 +25,17 @@
def save!
raise ::ActiveRecord::RecordInvalid unless valid?
prepare(&:save!)
end
+ def request
+ @request ||= user.approval_requests.new
+ end
+
+ def error_full_messages
+ [errors, request.errors].flat_map(&:full_messages)
+ end
+
private
def prepare
raise NotImplementedError, "you must implement #{self.class}##{__method__}"
end