なぜ私がこれを取得しているのか分かりません。私は読書の束をした、私はこれの頭や尾を作ることはできません。406このような基本コントローラーでは受け入れられません
マイコントローラ:
def create
@emails = Email.new(params[:email])
respond_to do |format|
if @emails.save
flash[:notice] = 'Email was successfully created.'
format.html { redirect_to admin_emails_path(:mail_type => @emails.mail_type) }
format.xml { render :xml => @emails, :status => :created, :location => @emails }
else
format.html { render :action => "new" }
format.xml { render :xml => @emails.errors, :status => :unprocessable_entity }
end
end
end
が狂っ何もありません。その複数の(画像)フォームの提出..それは何かと関係がありますか?
更新
いくつかのIRBもの:
>> admin_emails_path(:mail_type => @emails.mail_type)
"/admin/emails?mail_type=magic_email"
>> admin_emails_path(@emails)
"/admin/emails.%23%3Cemail:0x109eb6360%3E"
第二の例では、それは実際に、返すURLの私の追加のparamsを無視しているもののようです。
edit
リダイレクトはと同じであり、完全に動作することにも注意してください。
if @emails.save
flash[:notice] = 'Email was successfully created.'
debugger
format.html { render :action => "new" } # <=== WTF ?
format.xml { render :xml => @emails, :status => :created, :location => @emails }
else
そして、私はまだこの取得:
2は、ちょうどこのような状況がどのように完全に無力表示するアップデートは、私がこれに私のコントローラを変更した
Completed in 7401ms (View: 3, DB: 7) | 406 Not Acceptable [http://localhost/admin/emails.%23%3Cemail:0x109fd2a28%3E]
を
ルート
admin.resources :emails, :collection => {:test_email => :get}, :member => {:update_current => :get, :send_email => :get, :duplicate => :get} do |email|
email.resources :distributions, :collection => {:delete_dist => :get}
end
フォーム
- form_for @emails, :url => admin_email_path(@emails), :id => "email_form", :html => {:multipart => true} do |f|
... lots of stuff ..
.clear
%p
= f.submit 'Save Email', :class => "button"
http://stackoverflow.com/questions/1414446/weird-406-not-acceptable-error – jschorr
を参照してください。それは助けになりませんでした。 – Trip
私は何時でもこのコントローラーを使ってパラメーター[:mail_type]を問題なく送信しています。今は動作しません。代わりになるものが何であるかはわかりません。 – Trip