From b80eab40ccf31a64f51ad06efa753ddb836f02fc Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Mon, 30 Oct 2023 21:08:38 +0200 Subject: [PATCH] Slack's new api --- app/controllers/api/conferences_controller.rb | 7 +++++++ app/views/api/conferences/index.jbuilder | 1 + config/routes.rb | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 app/controllers/api/conferences_controller.rb create mode 100644 app/views/api/conferences/index.jbuilder diff --git a/app/controllers/api/conferences_controller.rb b/app/controllers/api/conferences_controller.rb new file mode 100644 index 0000000..116570c --- /dev/null +++ b/app/controllers/api/conferences_controller.rb @@ -0,0 +1,7 @@ +class Api::ConferencesController < Api::ApplicationController + include ::PublicApiExposing + + def index + @conferences = Conference.all + end +end diff --git a/app/views/api/conferences/index.jbuilder b/app/views/api/conferences/index.jbuilder new file mode 100644 index 0000000..9ef7719 --- /dev/null +++ b/app/views/api/conferences/index.jbuilder @@ -0,0 +1 @@ +json.array! @conferences, :id, :title, :start_date, :end_date, :created_at, :updated_at diff --git a/config/routes.rb b/config/routes.rb index 95b0f16..d5740cc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -17,7 +17,7 @@ Rails.application.routes.draw do end namespace :api do - resources :conferences, only: [] do + resources :conferences, only: [:index] do resources :events, only: :index do collection do get :halfnarp_friendly