Reputation: 5916
I need to add an API endpoint to a Rails (5.0.2) app so I have created a TransitController
under app/controllers/api
.
The controller, for now, looks like
module Api
class TransitController < ActionController::Api
def create
respond_to do |format|
format.json { render :status => :ok, :nothing => true }
end
end
end
end
I have updated my routes
as follows
namespace :api do
post 'transits', to: 'transits#create'
end
But now, when I try to hit the endpoint via curl I get
ActionController::RoutingError (uninitialized constant ActionController::Api)
In Rails 5+, shouldn't ActionController::Api
be available by default?
Am I missing anything here?
Thanks
Upvotes: 4
Views: 4439