Sha256: ae248861c61c5230e167ef625133dc43979d3a61273d55f52d78314412467e5a
Contents?: true
Size: 730 Bytes
Versions: 18
Compression:
Stored size: 730 Bytes
Contents
# frozen_string_literal: true module Motor class ConfigsController < ApiBaseController wrap_parameters :data, except: %i[include fields] load_and_authorize_resource def index render json: { data: Motor::ApiQuery::BuildJson.call(@configs, params) } end def create @config = Motor::Config.find_or_initialize_by(key: @config.key).tap do |config| config.value = @config.value end @config.save! Motor::Configs::WriteToFile.call render json: { data: Motor::ApiQuery::BuildJson.call(@config, params) } rescue ActiveRecord::RecordNotUnique retry end private def config_params params.require(:data).permit! end end end
Version data entries
18 entries across 18 versions & 1 rubygems