Errors and flash[:error]

Brian
Thu, 24 May 2012 13:35:16 -0000

What is the relationship, if any, between the errors array for one of
my models and flash[:error]? Are validation errors automatically added
to the flash? Is there a helper I can use in my view to merge the
results?

Situation:

I provide a form, of sorts, for creating HABTM relationships between
two other models. The HABTM model does a bunch of validation to make
sure it won''t save an invalid record. Additionally, each of the models
being associated has an "owner" and I need to verify in my controller
that the owner matches my session data to prevent somebody from
creating associations on someone else''s behalf.

I''d like to provide a bullet list of the combined results of
validation errors and session matching errors.

The UI on my form should prevent both types of errors. So from the end
user''s perspective there is no meaningful difference.

--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org