diff options
author | Matija Čupić <matteeyah@gmail.com> | 2018-01-29 20:39:06 +0300 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2018-02-05 20:58:18 +0300 |
commit | 0bfcdd66bf932c080398ff264323b5c0df17d05c (patch) | |
tree | 1c306a83624c53ec65ec67229de5033096d35593 /app/controllers/projects/variables_controller.rb | |
parent | 6b82a9ef51f59d37975bd5de48142d1a0a8504de (diff) |
Use `resource` in Project Variables routing scheme
Diffstat (limited to 'app/controllers/projects/variables_controller.rb')
-rw-r--r-- | app/controllers/projects/variables_controller.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/app/controllers/projects/variables_controller.rb b/app/controllers/projects/variables_controller.rb index 99dea65927d..2f03603bd1d 100644 --- a/app/controllers/projects/variables_controller.rb +++ b/app/controllers/projects/variables_controller.rb @@ -1,7 +1,18 @@ class Projects::VariablesController < Projects::ApplicationController before_action :authorize_admin_build! - def save_multiple + def show + respond_to do |format| + format.json do + variables = @project.variables + .map { |variable| variable.present(current_user: current_user) } + + render status: :ok, json: { variables: variables } + end + end + end + + def update respond_to do |format| format.json do return head :ok if @project.update(variables_params) |