“render :nothing => true” returns empty plaintext file?

后端 未结 2 1282
遇见更好的自我
遇见更好的自我 2020-12-12 11:43

I\'m on Rails 2.3.3, and I need to make a link that sends a post request.

I have one that looks like this:

= link_to(\'Resend Email\', 
  {:controlle         


        
2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-12 12:32

    UPDATE: This is an old answer for legacy Rails versions. For Rails 4+, see William Denniss' post below.

    Sounds to me like the content type of the response isn't correct, or isn't correctly interpreted in your browser. Double check your http headers to see what content type the response is.

    If it's anything other than text/html, you can try to manually set the content type like this:

    render :nothing => true, :status => 200, :content_type => 'text/html'
    

提交回复
热议问题