Ryan Prins
2006-Jun-21 06:21 UTC
[Rails] error_messages_for not displaying validation errors
Hi all, I''ve been searching the web and the list archives for help on this and I''ve found some tips, but I''ve been racking my brain on this for hours. I have a Model, View, and Controller that are handling the uploading of a file to my server. I want to make sure that the description is set and that a file is selected to be uploaded. I have set validates_presence_of for both of these fields in my model and added error_messages_for in my view. However, the errors are not being displayed. But, if I output @ myobject.errors, I see that the errors are in fact being logged, just not displayed via error_messages_for. Any help that you can offer is appreciated. Here are links to my code: - Model: http://dev.lazyi.net/ruby_code/user_file.rb.html - View: http://dev.lazyi.net/ruby_code/new.rhtml.html - Controller: http://dev.lazyi.net/ruby_code/user_file_controller.rb.html Many thanks, Ryan -- Ryan Prins rprins@gmail.com http://www.lazyi.net -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060621/344e87b2/attachment.html
Craig
2006-Jun-21 07:58 UTC
[Rails] Re: error_messages_for not displaying validation errors
Change @content in your controller code to @user_file -- Posted via http://www.ruby-forum.com/.
Ryan Prins
2006-Jun-21 16:33 UTC
[Rails] Re: error_messages_for not displaying validation errors
Hi Craig, Thanks for the tip. That worked like a charm! Best, Ryan On 6/21/06, Craig <craig@email.com> wrote:> > Change @content in your controller code to @user_file > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Ryan Prins rprins@gmail.com http://www.lazyi.net -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060621/1b030b9b/attachment.html