For example I have index action:
def index
if params[:query]
@pharmaceutics = Pharmaceutic.where("name LIKE ?", params[:query])
elsif params[:code]
@pharmaceutics = Pharmaceutic.where("barcode LIKE ?", params[:code])
else
@pharmaceutics = Pharmaceutic.all
end
end
And when I send two params: code and query I would like to filter my Pharmaceutics using both of them. I have MySQL database.