jeudi 5 décembre 2019

"How to use query parameter like strong parameter"?

How can i use query parameter as a strong parameter. This is my POST /tag method called by frontend to search posts.

def tag
  if params[:category] == 'Shop'
     render json: ShopPostPopulator.new(params[:search]).run
  else
     render json: Part.search(params[:search])
  end
end

If i want to use strong parameter instead of 'params[:search]', how should I do it.

Aucun commentaire:

Enregistrer un commentaire