Files
old-roraccounting/app/controllers/gangs_controller.rb

29 lines
604 B
Ruby
Raw Normal View History

2020-10-07 18:26:59 +03:00
class GangsController < ApplicationController
def show
if Gang.count.zero?
Gang.create.save
end
json_response Gang.first
end
def update
if gang_params[:chip_scale].to_i.positive?
Gang.update(gang_params)
json_response onboarded: true
else
error_response :bad_request
end
end
private
def gang_params
params.require(:gang).permit :chip_name,
:chip_code,
:chip_symbol,
:chip_scale,
:chip_prefixed
end
end