0

I have a CommunitiesSearchController with a search method.

I defined its route like this:

namespace :api, defaults: { format: 'json' } do
    namespace :v1 do          
      resources :communities
      get 'community/search/coordinates/:latitude/:longitude', to: 'communities_search#search'
    end
  end

But when I try to access it:

ActionController::RoutingError (No route matches [GET] "/api/v1/community/search
/coordinates/49.2864807/-123.142214"):

I'm using rails 5.

rails routes command:

                  api_v1 GET      /api/v1/community/search/coordinates/:latitude
/:longitude(.:format) api/v1/communities_search#search {:format=>"json"}

SOLUTION Please view:

Why do routes with a dot in a parameter fail to match?

Community
  • 1
  • 1
Marco Noronha
  • 115
  • 1
  • 9
  • 31

0 Answers0