Sono su Rails 2.3.3 e devo creare un collegamento che invii una richiesta di post."render: nothing => true" restituisce il file di testo in chiaro vuoto?
Ho uno che assomiglia a questo:
=link_to('Resend Email', {:controller => 'account', :action => 'resend_confirm_email' }, {:method => :post})
Il che rende il comportamento JavaScript appropriato sul link:
<a href="/account/resend_confirm_email" onclick="var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var s = document.createElement('input'); s.setAttribute('type', 'hidden'); s.setAttribute('name', 'authenticity_token'); s.setAttribute('value', 'EL9GYgLL6kdT/eIAzBritmB2OVZEXGRytPv3lcCdGhs='); f.appendChild(s);f.submit();return false;">Resend Email</a>'
La mia azione di controllo è in funzione, e impostare per rendere nulla:
respond_to do |format|
format.all { render :nothing => true, :status => 200 }
end
Ma quando faccio clic sul collegamento, il mio browser scarica un file di testo vuoto denominato "resend_confirm_ e-mail."
Cosa dà?
Per rotaie 5, è possibile rivedere questa risposta https://stackoverflow.com/a/34688727/1770571 –
Per rotaie 5 è possibile rivedere questa risposta https: //stackoverflow.com/a/34688727/1770571 –