Fritz Anderson
2008-Oct-17 20:40 UTC
ActionMailer template gets nil param from non-nil deliver_
Rails 1.2.6 ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0] =Summary: I pass a non-nil parameter to an ActionMailer class''s deliver_* method. The corresponding * instance method for the ActionMailer gets a nil instead. Disaster ensues. Will someone please tell me what I''m doing wrong? =Details: I have an ActionMailer::Base class with the following template method: def request(req) # Control reaches here. req is logged as nil: logger.info "in MyMailer#request, request = #{req.inspect}" # Exception in the following, owing to the nil: subject "Request for authsmtp exception (#{req.permit_ip})" # etc. end This is invoked through this method in my ActionController::Base class: def create @permission = Permission.new(params[:permission]) if @permission.save # @permission is non-nil, and as expected, in the following log: logger.info "In PermissionsController#create, @permission #{@permission.inspect}" MyMailer.deliver_request(@permisssion) # Mail the request to approvers. # etc. end end As noted in the comments, @permission is non-nil when passed to deliver_request(). In request(), the corresponding parameter, req, is nil. I am stymied. I have searched the archives, and nothing obvious presents itself. Will someone please help me get started again? (This is my first post through this forum software. I am hoping it doesn''t destroy linebreaks or indentation. If they do get clobbered, I apologize, and would like to know how not to get them clobbered.) — F -- 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-/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 -~----------~----~----~----~------~----~------~--~---
Fritz Anderson
2008-Oct-20 14:59 UTC
Re: ActionMailer template gets nil param from non-nil delive
Fritz Anderson wrote:> Rails 1.2.6 > ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0] > > =Summary: > > I pass a non-nil parameter to an ActionMailer class''s deliver_* method. > The corresponding * instance method for the ActionMailer gets a nil > instead. Disaster ensues.Never mind. The cause was a typo in my own code, and my (apparently failing) eyes never managed to see it. Thanks for the attention of whomever paid attention. — F -- 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-/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 -~----------~----~----~----~------~----~------~--~---