derrinc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Feb-23 22:21 UTC
ActionView::TemplateError In Production Mode
Hello RoR Folks, I''m working on document submission web app hosted at site5.com. I''ve run into an issue that I can''t seem to solve. I''m using ActionMailer to send an email any time a document is submitted. My code is bombing out when processing the template for the mailer. Here is an excerpt from the product log file: ActionView::TemplateError (undefined method `each'' for nil:NilClass) on line #19 of app/views/document_mailer/send_upload.rhtml: 16: 17: Submission Authors: 18: <% i = 1 -%> 19: <% @authors.each do |author| -%> 20: <%= i -%>. <%= author.lastname -%>, <%= author.firstname %> 21: <%= author.email %> 22: <% i += 1 %> Relevant code from the controller: # Find the login, submission and authors associated with this document @login = Login.find(session[:id]) @submission = Submission.find(session[:sub_id]) @authors = Participant.find(:all, :conditions => [ "submission_id = ?", session[:sub_id] ] ) Model: def send_upload(submission, login, authors) @subject = ''New Document Submission'' @body = { "login" => login, "submission" => submission, "authors" => authors } View: Submission Authors: <% i = 1 -%> <% @authors.each do |author| -%> <%= i -%>. <%= author.lastname -%>, <%= author.firstname %> <%= author.email %> <% i += 1 %> <% end -%> The strange thing is that this code works properly when the app is in development mode. I am a RoR neophite, this being my first Rails app. So hopefully there is a simple step that I am missing. Thanks for your help. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
derrinc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Feb-23 22:36 UTC
Re: ActionView::TemplateError In Production Mode
Don''t you hate folks that follow up their original post with more details... Anyway, contrary to my earlier post, it does not matter if the app is in development or production mode. What does matter is whether or not I''m using site5.com''s fast cgi. In my .htaccess file, flopping back and forth between dispatch.fcgi and dispatch.cgi will cause my original problem. But of course, I don''t want to use the regular cgi as it is slow like slug. #RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] RewriteRule ^(.*)$ dispatch.cgi [QSA,L] Any insight is greatly appreciated. derrin On Feb 23, 12:21 pm, "derr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <derr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello RoR Folks, > > I''m working on document submission web app hosted at site5.com. I''ve > run into an issue that I can''t seem to solve. I''m using ActionMailer > to send an email any time a document is submitted. My code is bombing > out when processing the template for the mailer. Here is an excerpt > from the product log file: > > ActionView::TemplateError (undefined method `each'' for nil:NilClass) > on line #19 of app/views/document_mailer/send_upload.rhtml: > 16: > 17: Submission Authors: > 18: <% i = 1 -%> > 19: <% @authors.each do |author| -%> > 20: <%= i -%>. <%= author.lastname -%>, <%= author.firstname %> > 21: <%= author.email %> > 22: <% i += 1 %> > > Relevant code from the controller: > # Find the login, submission and authors associated with this > document > @login = Login.find(session[:id]) > @submission = Submission.find(session[:sub_id]) > @authors = Participant.find(:all, :conditions => > [ "submission_id = ?", session[:sub_id] ] ) > > Model: > def send_upload(submission, login, authors) > @subject = ''New Document Submission'' > @body = { "login" => login, > "submission" => submission, > "authors" => authors } > > View: > Submission Authors: > <% i = 1 -%> > <% @authors.each do |author| -%> > <%= i -%>. <%= author.lastname -%>, <%= author.firstname %> > <%= author.email %> > <% i += 1 %> > <% end -%> > > The strange thing is that this code works properly when the app is in > development mode. I am a RoR neophite, this being my first Rails > app. So hopefully there is a simple step that I am missing. Thanks > for your help.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---