Skip to content
Snippets Groups Projects
Commit 19ab3d69 authored by Israel Barreto Sant'Anna's avatar Israel Barreto Sant'Anna
Browse files

Changed tag search parameter from id to name

parent dc33ade2
No related branches found
No related tags found
No related merge requests found
...@@ -44,8 +44,13 @@ class V1::SearchController < ApplicationController ...@@ -44,8 +44,13 @@ class V1::SearchController < ApplicationController
# GET v1/search/tag # GET v1/search/tag
# GET v1/search/tag.json # GET v1/search/tag.json
def tag def tag
results = TagSearchService.search(Tag.find(tag_search_params[:id])) t = Tag.find_by_name(tag_search_params[:name])
render json: paginate(results) if t.nil?
render json: {"error": "Tag not found."}, status: :unprocessable_entity
else
results = TagSearchService.search(t)
render json: paginate(results), status: :ok
end
end end
private private
...@@ -60,6 +65,6 @@ class V1::SearchController < ApplicationController ...@@ -60,6 +65,6 @@ class V1::SearchController < ApplicationController
end end
def tag_search_params def tag_search_params
params.permit(:page, :results_per_page, :id) params.permit(:page, :results_per_page, :name)
end end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment