I am not sure about best practice but I created a file config/
initializers/active_record.rb
with the content of http://gist.github.com/376389 and reload the
server.

as far as I understand, the initializers folder is the place to have
stuff you want to load at startup for all environments.
And what Michael's code is doing is opening the class Errors inside
ActiveRecord module and adding the method merge!

please correct me if it's not accurate.
also, where can I find more insights about the initialize process?

On Apr 23, 1:57 pm, Matthew Hillsborough
<[email protected]> wrote:
> Michael,
>
> Thank you for this, I will try it right away.
>
> Mind if I ask where the best place to put this code in as a best practice
> for Rails?
>
> Matthew
>
>
>
> On Fri, Apr 23, 2010 at 5:49 AM, Michael Pavling <[email protected]> wrote:
> > On 23 April 2010 01:23, Matthew Hillsborough
> > <[email protected]> wrote:
> > > That is what I can't figure out. Why am I getting Bars is invalid
> > > versus the error messages displayed above, ["Real can't be blank",
> > > "Real you must supply a valid email"]  etc.
>
> > > How do I have this output the real error messages so the user has some
> > > insight into what they did wrong? How do I write my render method in
> > > my controller to show all of the appropriate error messages? And more
> > > important, what will my xml builder view look?
>
> > I tend to use the "merge errors" process gleaned from
> >http://dev.rubyonrails.org/attachment/ticket/11394/merge_bang_errors....
>
> >http://gist.github.com/376389
>
> > Then in your controller you can use:
>
> > �[email protected]! bar.errors
>
> > ... and the view will work as normal, but with nice errors :-)
>
> > --
> > 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 [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<rubyonrails-talk%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?hl=en.
>
> --
> 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 [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to