weixin_33711647 2017-10-23 21:51 采纳率: 0%
浏览 61

Rails 5操作邮件错误

I'm having issues with rails action mailer. When I click on my subscribe button I keep getting the same error for almost an hour now, after spending the same amount of time trying to fix it. I don't know what I'm missing or what I need. Any help please. I want the user to click on the subscribe button and to have it save and then send them a verification email. This is the error message I keep receiving "SubscribersController#show is missing a template for this request format and variant. request.formats: ["text/html"] request.variant: [] NOTE! For XHR/Ajax or API requests, this action would normally respond with 204 No Content: an empty white screen. Since you're loading it in a web browser, we assume that you expected to actually render a template, not nothing, so we're showing an error to be extra-clear. If you expect 204 No Content, carry on. That's what you'll get from an XHR or API request. Give it a shot."

This is the code for my controller-

class SubscribersController < ApplicationController

respond_to? :html, :json

def index
@subscriber = Subscriber.new
end

def show
end

def create
@subscriber = Subscriber.new(subscriber_params)
respond_to do |format|
    if @subscriber.save
      # Tell the UserMailer to send a welcome email after save
      SubscriberMailer.welcome_email(@subscriber).deliver_now

      format.html { redirect_to(@subscriber, notice: 'User was successfully created.') }
      format.json { render json: @subscriber, status: :created, location: @subscriber }
    else
      format.html { render action: 'new' }
      format.json { render json: @subscriber.errors, status: :unprocessable_entity }
    end
  end
end
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 优质github账号直接兑换rmb,感兴趣伙伴可以私信
    • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
    • ¥15 安装svn网络有问题怎么办
    • ¥15 Python爬取指定微博话题下的内容,保存为txt
    • ¥15 vue2登录调用后端接口如何实现
    • ¥65 永磁型步进电机PID算法
    • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
    • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
    • ¥15 如何处理复杂数据表格的除法运算
    • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)