On Jul 21, 11:44 am, karthik k <[email protected]> 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')
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---