简体   繁体   中英

Respond_to no content rails 4.1.9

I have the following in my controller, worked on 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

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 ? eg .../signup.json

Probably when signup are being called, it won't requiring a JSON output. Changing to this should be work.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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