about summary refs log tree commit diff
path: root/app/controllers/api/v1/trends_controller.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-08-06 17:25:54 +0200
committerGitHub <noreply@github.com>2019-08-06 17:25:54 +0200
commit8400ddca7155005ab79485ed6054c04ea3ca5667 (patch)
tree696f5ae9a70891e96fdf819905b05aa6482bcf07 /app/controllers/api/v1/trends_controller.rb
parent3ea7a334d89d2c4075b1dbf649d692ff49325f2e (diff)
parentd10f6036cfeebec5b2c160db8659d2c19d29fe9c (diff)
Merge pull request #1191 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/controllers/api/v1/trends_controller.rb')
-rw-r--r--app/controllers/api/v1/trends_controller.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/api/v1/trends_controller.rb b/app/controllers/api/v1/trends_controller.rb
new file mode 100644
index 000000000..bcea9857e
--- /dev/null
+++ b/app/controllers/api/v1/trends_controller.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class Api::V1::TrendsController < Api::BaseController
+  before_action :set_tags
+
+  respond_to :json
+
+  def index
+    render json: @tags, each_serializer: REST::TagSerializer
+  end
+
+  private
+
+  def set_tags
+    @tags = TrendingTags.get(limit_param(10))
+  end
+end