{"action":"opened","issue":{"url":"https://api.github.com/repos/rails/rails/issues/24230","repository_url":"https://api.github.com/repos/rails/rails","labels_url":"https://api.github.com/repos/rails/rails/issues/24230/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/24230/comments","events_url":"https://api.github.com/repos/rails/rails/issues/24230/events","html_url":"https://github.com/rails/rails/issues/24230","id":141705130,"number":24230,"title":"`Could not render layout: undefined local variable or method `mailer' for #","user":{"login":"hallmatt","id":904874,"avatar_url":"https://avatars.githubusercontent.com/u/904874?v=3","gravatar_id":"","url":"https://api.github.com/users/hallmatt","html_url":"https://github.com/hallmatt","followers_url":"https://api.github.com/users/hallmatt/followers","following_url":"https://api.github.com/users/hallmatt/following{/other_user}","gists_url":"https://api.github.com/users/hallmatt/gists{/gist_id}","starred_url":"https://api.github.com/users/hallmatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hallmatt/subscriptions","organizations_url":"https://api.github.com/users/hallmatt/orgs","repos_url":"https://api.github.com/users/hallmatt/repos","events_url":"https://api.github.com/users/hallmatt/events{/privacy}","received_events_url":"https://api.github.com/users/hallmatt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-17T20:58:40Z","updated_at":"2016-03-17T20:58:40Z","closed_at":null,"body":"### Steps to reproduce\r\n\r\nRun command `rails generate mailer LoanMailer`\r\n\r\nAdd code to mailer:\r\n\r\n```\r\n  def notify\r\n    mail(:from => \"loans@gmail.com\", :to => \"email@gmail.com\", :subject => \"New Email\")\r\n  end\r\n```\r\n\r\nCall mailer:\r\n\r\n`LoanMailer.notify.deliver`\r\n\r\n### Expected behavior\r\nThe email should be sent and delivered to the recipient. \r\n\r\n### Actual behavior\r\n```\r\nCould not render layout: undefined local variable or method `mailer' for #<LoanMailer:0x007f83b50c3448>\r\n```\r\n\r\n### System configuration\r\n**Rails version**: Rails 5.0.0.beta3\r\n\r\n**Ruby version**:\r\nruby 2.2.2p95\r\n\r\nSwitching the layout line in application_mailer.rb seems to do the trick and send the email as desired.\r\n\r\nSwitch  `layout :mailer` to `layout \"mailer\"`\r\n\r\n"}}