简体   繁体   English

Respond_to没有内容轨4.1.9

[英]Respond_to no content rails 4.1.9

I have the following in my controller, worked on Rails 3.2 我的控制器中有以下内容,在Rails 3.2上工作过

 def signup
    ::MailchimpSignup.build(params)
    respond_to do |format| <---- Error coming from here.
      format.json { head :no_content }
    end
  end

After upgrade to Rails 4.1.9, I get ActionController::UnknownFormat 升级到Rails 4.1.9之后,我得到了ActionController::UnknownFormat

I need it to not redirect, and render no content. 我需要它不重定向,并且不呈现任何内容。 Is there a way to accomplish this? 有没有办法做到这一点?

Thanks 谢谢

Are you sure you are requesting json ? 您确定要json吗? eg .../signup.json 例如.../signup.json

Probably when signup are being called, it won't requiring a JSON output. 可能在调用注册时,不需要JSON输出。 Changing to this should be work. 更改为此应该是可行的。

def signup
  ::MailchimpSignup.build(params)
  head :no_content
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM