module Api::V1
class ApiController < ActionController::API
include DeviseTokenAuth::Concerns::SetUserByToken
rescue_from ActiveRecord::RecordNotFound, with: :record_not_found
def record_not_found
render json: { errors: "Requested object not found" }, status: :not_found
end
end
end
contacts_controller.rb
module Api::V1
class ContactsController < ApiController
before_action :authenticate_user!
expose(:contacts) { Contact.all }
expose(:contact)
def index; end
end
end
Doing GET http://localhost:3000/api/v1/contacts yields ActionController::RoutingError - undefined method 'helper_method'
api_controller.rb
contacts_controller.rb
Doing
GET http://localhost:3000/api/v1/contacts
yieldsActionController::RoutingError - undefined method 'helper_method'
Full backtrace
What am I doing wrong?