app/controllers/api
の下にTransitController
を作成したので、Rails(5.0.2)アプリにAPIエンドポイントを追加する必要があります。既存のRails 5アプリにAPIエンドポイントを追加する
namespace :api do
post 'transits', to: 'transits#create'
end
しかし、私はカール経由でエンドポイントにヒットしようとすると、今、私は
を取得し、次のようにコントローラは、今のところ、module Api
class TransitController < ActionController::Api
def create
respond_to do |format|
format.json { render :status => :ok, :nothing => true }
end
end
end
end
のように私は私のroutes
を更新しました見えます
ActionController::RoutingError (uninitialized constant ActionController::Api)
Rails 5以降では、デフォルトでActionController::Api
を使用できませんか?
ここに何か不足していますか?
おかげ
[ActionController :: RoutingError:初期化されていない定数Api :: V1 :: ApiController]の重複している可能性があります(http://stackoverflow.com/questions/40039279/actioncontrollerroutingerror-uninitialized-constant-apiv1apicontroller) –