467,166 Members | 1,076 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,166 developers. It's quick & easy.

Help w/ errors.add_to_base between controller and model

Help w/ errors.add_to_base between controller and model

Hello,

I'm having trouble in routing some errors between model and
controller. The errors produced in the controller
(invite_controller.rb) are collected and spit out nicely in a
flash[:validate] method as such:

Expand|Select|Wrap|Line Numbers
  1. if errors.size > 0
  2.    flash[:validation] = errors.join('<br />')
  3. end
  4.  
Errors produced in the model (invite.rb) are displayed w/in a giant page
failure explosion and are not routed into the flash[:validate] method.

The code for the the method is as follows:
Expand|Select|Wrap|Line Numbers
  1. self.errors.add_to_base("an invitation has already been sent to
  2. #{email}")
  3.  
Is there a way where I can route the model errors to the
flash[:validate] method as I am in the controller?

Thanks for your help!
Feb 6 '07 #1
  • viewed: 4785
Share:

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Morgan Leppink | last post: by
reply views Thread by besaar@hotmail.com | last post: by
8 posts views Thread by Tim Geiges | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.