Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #4186 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

[PATCH] merging object errors with error_messages_for

Reported by: andrew@redlinesoftware.com Assigned to: David
Priority: normal Milestone: 1.1
Component: ActionPack Version: 1.0.0
Severity: normal Keywords:
Cc:

Description

This patch allows errors for more than one object to be merged into one error block.

A common case could be a form for a user signup where the data in the form relates to data from 2 models... common user data (that could be shared amongst many types of users and used in other forms) and user data specific to that user model. Now if an error occurs in one or both models, 2 distinct error blocks could be shown which is probably undesirable. This patch fixes that and allows errors from both models to appear as one.

More details on the why and how of the patch can be viewed here... http://www.redlinesoftware.com/labs.html#001

Attachments

patch.diff (7.4 kB) - added by akaspick on 03/11/06 06:23:55.
includes the patched method and test cases

Change History

03/11/06 06:23:55 changed by akaspick

  • attachment patch.diff added.

includes the patched method and test cases

03/13/06 14:17:54 changed by andrew@redlinesoftware.com

Quick line of code to get an understanding just by seeing it...

error_messages_for :user_common, :user, :default => :user

This will display error messages for two objects in one error block and default the block title to use :user.

04/26/06 23:09:19 changed by marcel

  • status changed from new to closed.
  • resolution set to fixed.

(In [4287]) Allow error_messages_for to report errors for multiple objects, as well as support for customizing the name of the object in the error summary header. Closes #4186. [andrew@redlinesoftware.com, Marcel Molina Jr.]