28 lines
577 B
Ruby
28 lines
577 B
Ruby
|
|
class OgsController < ApplicationController
|
||
|
|
def show
|
||
|
|
if Og.count.zero?
|
||
|
|
Og.create.save
|
||
|
|
end
|
||
|
|
|
||
|
|
json_response Og.first
|
||
|
|
end
|
||
|
|
|
||
|
|
def update
|
||
|
|
if og_params[:chip_scale].to_i.positive?
|
||
|
|
Og.update(og_params)
|
||
|
|
json_response onboarded: true
|
||
|
|
else
|
||
|
|
error_response :bad_request
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
private
|
||
|
|
|
||
|
|
def og_params
|
||
|
|
params.require(:og).permit :chip_name,
|
||
|
|
:chip_code,
|
||
|
|
:chip_symbol,
|
||
|
|
:chip_scale,
|
||
|
|
:chip_prefixed
|
||
|
|
end
|
||
|
|
end
|