Evan C wrote: > On Jul 21, 11:44�am, karthik k <cse.k.kart...@gmail.com> 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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---