neo
neo

Reputation: 4116

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

Upvotes: 0

Views: 123

Answers (2)

Sander Garretsen
Sander Garretsen

Reputation: 1723

Are you sure you are requesting json? e.g .../signup.json

Upvotes: 1

Daniel Loureiro
Daniel Loureiro

Reputation: 5343

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

Upvotes: 0

Related Questions