yatta20
2012-Jun-26 12:33 UTC
ActionView::Template::Error (undefined method `strftime'' for nil:NilClass)
Hello, I''m a newbie. I need help resolving this issue. I recently added a pdf to the newsletter admin section of the website and now I can no longer view page 2 of the list of pdf''s. Nor can I login to see the newsletters as a student. I''m using Ruby 1.9.3, Rails 3.2.1. Here''s the information from the log file. ActionView::Template::Error (undefined method `strftime'' for nil:NilClass): 28: <%- locals = {:enewsletter => enewsletter} %> 29: <td nowrap="nowrap" class=''enewsletter_name''><%= enewsletter.subscription.title %></td> 30: <td nowrap="nowrap"><%=enewsletter.title%></td> 31: <td nowrap="nowrap"><%=enewsletter.publication_date.strftime("%m/%Y")%></td> 32: <td nowrap="nowrap"> <%=enewsletter.require_ama_disclaimer%></td> 33: <td> 34: <%#= link_to("Edit Release", edit_admin_release_path(release), edit_admin_release_path(release)) %> app/views/admin/enewsletters/index.html.erb:31:in `_app_views_admin_enewsletters_index_html_erb__1819630787_23456257799140_0'' app/views/admin/enewsletters/index.html.erb:26:in `each'' app/views/admin/enewsletters/index.html.erb:26:in `_app_views_admin_enewsletters_index_html_erb__1819630787_23456257799140_0'' app/controllers/admin/enewsletters_controller.rb:17:in `index'' Please advise -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/JtelWu81bFMJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Carlos Mathiasen
2012-Jun-26 12:46 UTC
Re: ActionView::Template::Error (undefined method `strftime'' for nil:NilClass)
Hi, you can see the error in this log: ActionView::Template::Error (undefined method `strftime'' for nil:NilClass): nil.strftime("%m/%Y") doesn''t exists 31: <td nowrap="nowrap"><%=enewsletter.publication_date.strftime("%m/%Y")%></td> enewsletter.publication_date is nil Matt''s -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
jsnark
2012-Jun-26 12:54 UTC
Re: ActionView::Template::Error (undefined method `strftime'' for nil:NilClass)
The message says that enewsletter.publication_date is nil. Check the database to make sure that all instances have a valid date for this field. you should add a validation to the model to prevent creating a row with a nil value. On Tuesday, June 26, 2012 8:33:31 AM UTC-4, yatta20 wrote:> > Hello, I''m a newbie. I need help resolving this issue. I recently added > a pdf to the newsletter admin section of the website and now I can no > longer view page 2 of the list of pdf''s. Nor can I login to see the > newsletters as a student. I''m using Ruby 1.9.3, Rails 3.2.1. > Here''s the information from the log file. > > ActionView::Template::Error (undefined method `strftime'' for nil:NilClass): > > 28: <%- locals = {:enewsletter => enewsletter} %> > > 29: <td nowrap="nowrap" class=''enewsletter_name''><%= > enewsletter.subscription.title %></td> > > 30: <td > nowrap="nowrap"><%=enewsletter.title%></td> > > 31: <td > nowrap="nowrap"><%=enewsletter.publication_date.strftime("%m/%Y")%></td> > > 32: <td nowrap="nowrap"> > <%=enewsletter.require_ama_disclaimer%></td> > > 33: <td> > > 34: <%#= link_to("Edit Release", > edit_admin_release_path(release), edit_admin_release_path(release)) %> > > > app/views/admin/enewsletters/index.html.erb:31:in > `_app_views_admin_enewsletters_index_html_erb__1819630787_23456257799140_0'' > > app/views/admin/enewsletters/index.html.erb:26:in `each'' > > app/views/admin/enewsletters/index.html.erb:26:in > `_app_views_admin_enewsletters_index_html_erb__1819630787_23456257799140_0'' > > app/controllers/admin/enewsletters_controller.rb:17:in `index'' > > > > Please advise >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/5VwejydJyeAJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
yatta20
2012-Jun-26 13:13 UTC
Re: ActionView::Template::Error (undefined method `strftime'' for nil:NilClass)
I replaced line 31 with the following text: <td nowrap="nowrap"><%unless enewsletter.publication_date.nil?%><%=enewsletter.publication_date.strftime("%m/%Y")%></td> I still get the page We''re sorry but something went wrong. On Tuesday, June 26, 2012 8:46:30 AM UTC-4, Carlos Mathiasen wrote:> Hi, you can see the error in this log: > > ActionView::Template::Error (undefined method `strftime'' for nil:NilClass): > nil.strftime("%m/%Y") doesn''t exists > > 31: <td > nowrap="nowrap"><%=enewsletter.publication_date.strftime("%m/%Y")%></td> > > enewsletter.publication_date is nil > > > Matt''s > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/sj48x0r69wAJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
yatta20
2012-Jun-26 13:21 UTC
Re: ActionView::Template::Error (undefined method `strftime'' for nil:NilClass)
On Tuesday, June 26, 2012 8:33:31 AM UTC-4, yatta20 wrote:> > Hello, I''m a newbie. I need help resolving this issue. I recently added > a pdf to the newsletter admin section of the website and now I can no > longer view page 2 of the list of pdf''s. Nor can I login to see the > newsletters as a student. I''m using Ruby 1.9.3, Rails 3.2.1. > Here''s the information from the log file. > > ActionView::Template::Error (undefined method `strftime'' for nil:NilClass): > > 28: <%- locals = {:enewsletter => enewsletter} %> > > 29: <td nowrap="nowrap" class=''enewsletter_name''><%= > enewsletter.subscription.title %></td> > > 30: <td > nowrap="nowrap"><%=enewsletter.title%></td> > > 31: <td > nowrap="nowrap"><%=enewsletter.publication_date.strftime("%m/%Y")%></td> > > 32: <td nowrap="nowrap"> > <%=enewsletter.require_ama_disclaimer%></td> > > 33: <td> > > 34: <%#= link_to("Edit Release", > edit_admin_release_path(release), edit_admin_release_path(release)) %> > > > app/views/admin/enewsletters/index.html.erb:31:in > `_app_views_admin_enewsletters_index_html_erb__1819630787_23456257799140_0'' > > app/views/admin/enewsletters/index.html.erb:26:in `each'' > > app/views/admin/enewsletters/index.html.erb:26:in > `_app_views_admin_enewsletters_index_html_erb__1819630787_23456257799140_0'' > > app/controllers/admin/enewsletters_controller.rb:17:in `index'' > > > > Please advise >I found another error message. Started GET "/enewsletters" for 74.7.15.131 at Wed Jun 20 13:42:07 -0500 2012 Processing by EnewslettersController#index as HTML Rendered enewsletters/index.html.erb within layouts/spree_application (23.5ms) Completed 500 Internal Server Error in 45ms ActionView::Template::Error (undefined method `strftime'' for nil:NilClass): 17: <%newsletter_url = "/enewsletter_download/#{enewsletter.id.to_s}"%> 18: <%end%> 19: <a href="<%=newsletter_url%>" class="enewsletter_link"> 20: <h3><%=enewsletter.publication_date.strftime("%m/%Y")%> | <%=enewsletter.title%></h3> 21: </a> 22: </li> 23: <%if enewsletter.posttest.exists?%> app/views/enewsletters/index.html.erb:20:in `_app_views_enewsletters_index_html_erb___1681926547_23456253999680_0'' app/views/enewsletters/index.html.erb:12:in `_app_views_enewsletters_index_html_erb___1681926547_23456253999680_0'' app/views/enewsletters/index.html.erb:9:in `_app_views_enewsletters_index_html_erb___1681926547_23456253999680_0'' app/controllers/enewsletters_controller.rb:14:in `index'' -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/mFxtgQrhDnIJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Possibly Parallel Threads
- ActionView::Template::Error (undefined method `strftime' for nil:NilClass):
- OT :JavascriptSortableTables
- Selecting Links with their parent class attribute?
- [LLVMdev] ScalarEvolution, HowManyLessThans question for step > 1
- How do you deal with non-model property form values