# About Error handler

**URL:** <https://www.ruby-forum.com/t/about-error-handler/172423>\
**Category:** Rails\
**Created:** [July 21, 2009, 12:45pm UTC](https://www.ruby-forum.com/t/about-error-handler/172423 "2009-07-21T12:45:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![karthik](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/9fc348/32.png) [@karthik](https://www.ruby-forum.com/u/karthik)\
**Post date:** [July 21, 2009, 12:45pm UTC](https://www.ruby-forum.com/t/about-error-handler/172423/1 "2009-07-21T12:45:34Z")

</div>

Hi

I am new to ruby on rails  
I need to know one thing  
Is there any way to externalize all the error messages in one file and  
access

–  
Karthik.k  
Mobile - +91-9894991640

---

<div class="post-metadata">

**Author:** ![karthik](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/9fc348/32.png) [@karthik](https://www.ruby-forum.com/u/karthik)\
**Post date:** [July 21, 2009, 1:09pm UTC](https://www.ruby-forum.com/t/about-error-handler/172423/2 "2009-07-21T13:09:32Z")

</div>

On Jul 21, 11:44 am, karthik k [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi
> 
> I am new to ruby on rails  
> I need to know one thing  
> Is there any way to externalize all the error messages in one file and  
> access
> 
> –  
> Karthik.k  
> Mobile - +91-9894991640

Do you mean the error messages from a model instance? You can just use  
ruby’s standard file io methods to read and write a yaml file:

File.open(‘errors.yml’, ‘w’) do |out|  
out.write(my\_obj.errors.full\_messages.to\_yaml)  
end

to read it back in:  
errors = YAML.load\_file(‘errors.yml’)

---

<div class="post-metadata">

**Author:** ![karthik](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/9fc348/32.png) [@karthik](https://www.ruby-forum.com/u/karthik)\
**Post date:** [July 21, 2009, 1:38pm UTC](https://www.ruby-forum.com/t/about-error-handler/172423/3 "2009-07-21T13:38:55Z")

</div>

Evan C wrote:

> On Jul 21, 11:44ï¿½am, karthik k [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Hi
> > 
> > I am new to ruby on rails  
> > I need to know one thing  
> > Is there any way to externalize all the error messages in one file and  
> > access
> > 
> > –  
> > Karthik.k  
> > Mobile - +91-9894991640
> 
> Do you mean the error messages from a model instance? You can just use  
> ruby’s standard file io methods to read and write a yaml file:
> 
> File.open(‘errors.yml’, ‘w’) do |out|  
> out.write(my\_obj.errors.full\_messages.to\_yaml)  
> end
> 
> to read it back in:  
> errors = YAML.load\_file(‘errors.yml’)

hi Evan

Thank you for spending your precious time  
As i am very new to ruby on rails can i find any sample application on  
the above  
because i have some 50 models and all the error should be in one file  
e.g errors.yml

Even i dont know where to put this errors.yml file

Please guide me  
karthik.k
