2012-02-26 8 views
1

jquery mobileをrails 3.0アプリケーションで使用しています。ユーザーのリストからアイテムを削除しようとすると、ルーティングエラーが発生します。コードとエラーメッセージは次のとおりです。jqueryモバイルでルーティングエラーが発生しているRails 3.0アプリでアクションを破棄

index.mobile.erb:

<% @items.each do |i| %> 
    ... 
    <div data-role="button"> 
     <%= link_to 'Delete', i, :confirm => 'Are you sure?', :method => :delete %> 
    </div> 
<% end %> 

ルートファイル:

resources :items, :except => [:show] 

すくい経路:

DELETE /items/:id(.:format)   {:action=>"destroy", :controller=>"items"} 

エラーメッセージ:

Started GET "/items/2" for 127.0.0.1 at 2012-02-26 13:31:37 -0500 
ActionController::RoutingError (No route matches "/items/2"): 

私は何が欠けていますか?

ありがとうございます!

UPDATE - Firebugは:? @http:// localhostを:3000/JavaScriptの/ jqueryの - 1.6.1.js 1310343332:641 @http:// localhostを:3000/JavaScriptの/ jquery.mobile-1.0.1。 js?1329380575:2737 @http:// localhost:3000/javascripts/jquery.mobile-1.0.1.js?1329380575:3030 @http:// localhost:3000/javascripts/jquery.mobile-1.0.1.js? 1329380575:3393 @http:// localhost:3000/javascripts/jquery-1.6.1.js?1310343332:2926 @http:// localhost:3000/javascripts/jquery-1.6.1.js?1310343332:2560 jquery。 ..0343332(行641) "NetworkError:404 Not Found - http://localhost:3000/items/2"

答えて

1

あなたが抱えている問題のようですが、@Rails' link_to method: GETing when it should DELETEと同じです。

残りのリクエストパラメータ(chromeデベロッパーコンソールまたはFirebug)を貼り付けることはできますか?レールがHTTP削除動詞に対応するために魔法をしようとしているかどうかを確認する必要があります。

+0

Firebugの出力は今質問の末尾にあります。ありがとう。 – Jay

+0

firebugの出力はネットワーク要求パネルから出力されます。 –

関連する問題