eriwright
2008-Nov-12 09:56 UTC
Help! getting a "can''t dup NilClass" error and don''t know what to do about it.
Thanks for any help you can offer. I am trying to send out a small batch of emails using an http request. I know it sounds odd. hear me out. I have loaded a bunch of emails into this table and just want to slowly work through them. Sort of a poor mans AR:Mailer. But I am getting a "can''t dup NilClass" when I hit it with a http request. ********************************** def message @reminders = Reminder.find(:all, :order => "created_at DESC", :limit => 5) for reminder in @reminders ReminderMailer.deliver_reminder_message(reminder) reminder.destroy end render :nothing => true, :status => 401 # Unauhorized end ************************************ I believe the Mailer class is working right. Although when I remove the ReminderMailer line the rest of the method works fine. Please help if I am a million miles off on this and have some fundamental misunderstanding. Please, please take the time to tell me. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Nov-12 10:46 UTC
Re: Help! getting a "can''t dup NilClass" error and don''t know what to do about it.
On 12 Nov 2008, at 09:56, eriwright wrote:> > Thanks for any help you can offer. > > I am trying to send out a small batch of emails using an http > request. I know it sounds odd. hear me out. > > I have loaded a bunch of emails into this table and just want to > slowly work through them. Sort of a poor mans AR:Mailer. But I am > getting a "can''t dup NilClass" when I hit it with a http request.What''s the stack trace ? Fred> > > ********************************** > def message > @reminders = Reminder.find(:all, :order => "created_at DESC", :limit > => 5) > for reminder in @reminders > ReminderMailer.deliver_reminder_message(reminder) > reminder.destroy > end > render :nothing => true, :status => 401 # Unauhorized > end > ************************************ > > I believe the Mailer class is working right. Although when I remove > the ReminderMailer line the rest of the method works fine. > > Please help if I am a million miles off on this and have some > fundamental misunderstanding. Please, please take the time to tell > me. > --~--~---------~--~----~------------~-------~--~----~ > 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 > -~----------~----~----~----~------~----~------~--~--- >
eriwright
2008-Nov-12 16:34 UTC
Re: Help! getting a "can''t dup NilClass" error and don''t know what to do about it.
On Nov 12, 2:46 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 12 Nov 2008, at 09:56, eriwright wrote: > > > > > Thanks for any help you can offer. > > > I am trying to send out a small batch of emails using an http > > request. I know it sounds odd. hear me out. > > > I have loaded a bunch of emails into this table and just want to > > slowly work through them. Sort of a poor mans AR:Mailer. But I am > > getting a "can''t dup NilClass" when I hit it with a http request. > > What''s the stack trace ? > > Fred > > > > > > > ********************************** > > def message > > @reminders = Reminder.find(:all, :order => "created_at DESC", :limit > > => 5) > > for reminder in @reminders > > ReminderMailer.deliver_reminder_message(reminder) > > reminder.destroy > > end > > render :nothing => true, :status => 401 # Unauhorized > > end > > ************************************ > > > I believe the Mailer class is working right. Although when I remove > > the ReminderMailer line the rest of the method works fine. > > > Please help if I am a million miles off on this and have some > > fundamental misunderstanding. Please, please take the time to tell > > me. > > > > > > smime.p7s > 3KViewDownloadThank you for responding! here is the stack trace and while I am at it I have included the ReminderMailer class at the bottom. Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_view/ template_error.rb:11:in `dup'' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_view/ template_error.rb:11:in `initialize'' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb: 322:in `new'' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb: 322:in `render_file'' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb: 348:in `render_without_active_scaffold'' /Library/Ruby/Gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/ base.rb:502:in `render'' /Library/Ruby/Gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/ base.rb:494:in `render_message'' /Library/Ruby/Gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/ base.rb:442:in `create!'' /Library/Ruby/Gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/ base.rb:403:in `initialize'' /Library/Ruby/Gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/ base.rb:352:in `new'' /Library/Ruby/Gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/ base.rb:352:in `method_missing'' app/controllers/reminders_controller.rb:32:in `message'' app/controllers/reminders_controller.rb:31:in `each'' app/controllers/reminders_controller.rb:31:in `message'' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ base.rb:1158:in `send'' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ base.rb:1158:in `perform_action_without_filters'' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ filters.rb:697:in `call_filters'' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ filters.rb:689:in `perform_action_without_benchmark'' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ benchmarking.rb:68:in `perform_action_without_rescue'' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ benchmarking.rb:68:in `perform_action_without_rescue'' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ rescue.rb:199:in `perform_action_without_caching'' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ caching.rb:678:in `perform_action'' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/abstract/query_cache.rb:33:in `cache'' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/ query_cache.rb:8:in `cache'' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ caching.rb:677:in `perform_action'' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ base.rb:524:in `send'' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ base.rb:524:in `process_without_filters'' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ filters.rb:685:in `process_without_session_management_support'' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ session_management.rb:123:in `process'' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ base.rb:388:in `process'' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in `process'' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `synchronize'' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `process'' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb: 282:in `run'' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb: 281:in `each'' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb: 281:in `run'' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run'' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb: 212:in `run'' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281 /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ dependencies.rb:489:in `load'' /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ dependencies.rb:489:in `load'' /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ dependencies.rb:342:in `new_constants_in'' /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ dependencies.rb:489:in `load'' /Library/Ruby/Gems/1.8/gems/rails-2.0.2/lib/commands/servers/ mongrel.rb:64 /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ dependencies.rb:496:in `require'' /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ dependencies.rb:342:in `new_constants_in'' /Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/ dependencies.rb:496:in `require'' /Library/Ruby/Gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39 def reminder_message(reminder) @recipients = reminder.email @from = "ADMIN EMAIL" @subject = reminder.subject @sent_on = Time.now @content_type = "text/html" @body = reminder.body @firstname = reminder.firstname @lastname = reminder.lastname end --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Nov-12 16:53 UTC
Re: Help! getting a "can''t dup NilClass" error and don''t know what to do about it.
On 12 Nov 2008, at 16:34, eriwright wrote:> > Thank you for responding! here is the stack trace and while I am at it > I have included the ReminderMailer class at the bottom.I bet you reminder.body is nil. Fred> >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
eriwright
2008-Nov-12 17:32 UTC
Re: Help! getting a "can''t dup NilClass" error and don''t know what to do about it.
On Nov 12, 8:53 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 12 Nov 2008, at 16:34, eriwright wrote: > > > > > Thank you for responding! here is the stack trace and while I am at it > > I have included the ReminderMailer class at the bottom. > > I bet you reminder.body is nil. > > Fred >I bow to your superior intellect... lol seriously Thank you, thats exactly what the problem was, you are a gentleman and a scholar --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---