JSONをPOSTとしてHerokuサーバー上のRubyアプリに送信しています(Androidアプリから)。投稿のタイトルが示すように、Heroku のログ出力は次のとおりです。
Started GET "/app_session" for 62.40.34.220 at 2013-05-20 22:12:22 +0000
ActionController::RoutingError (No route matches [GET] "/app_session"):
これは Android リクエストです。
HttpPost httppost = new HttpPost(url.toString());
httppost.setHeader("Content-type", "application/json");
httppost.setHeader("Accept", "application/json");
StringEntity se = new StringEntity(json.toString());
httppost.setEntity(se);
HttpResponse response = httpclient.execute(httppost);
String temp = EntityUtils.toString(response.getEntity());
jsonResponse = new JSONObject(temp);
ルートファイルは次のとおりです。
resources :app_session, only: [:create, :destroy]
そしてrake routes
出力:
app_session_index POST /app_session(.:format) app_session#create
app_session DELETE /app_session/:id(.:format) app_session#destroy
何が起きてる?_index
に追加されるのはなぜapp_session
ですか? 確かにこれは問題...