Quantcast
Channel: User Misha Krul - Stack Overflow
Viewing all articles
Browse latest Browse all 42

routing error, no route match for rails api request

$
0
0

I've got my controller namespaced with API, and can't seem to make a request due to the following error:ActionController::RoutingError (No route matches [GET] "/api/request_projects")

Controller:

module Api  class Api::ProjectsController < ApplicationController      def request_projects      items = []      page = 1      total_count = Project.request_total_count      pages = Project.get_page_count(total_count)      pages.times do        items << Project.request_projects(page)        items_list = items.flatten        Project.create_from_request(items_list) if !items_list.empty?        page += 1      end    end  endend

Routes:

Rails.application.routes.draw do  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html  root 'pages#index'  namespace :api, defaults: { format: 'json' } do    resources :projects  end  match '*path', to: 'projects#request_projects', via: :allend

Viewing all articles
Browse latest Browse all 42

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>