Sha256: ee50c616a7a693c2bb4bed2cb2509cc48956471543d325acc83ce7c281e39fe0

Contents?: true

Size: 508 Bytes

Versions: 3

Compression:

Stored size: 508 Bytes

Contents

# frozen_string_literal: true

class Fields::OptionsController < Fields::ApplicationController
  before_action :set_options

  def edit; end

  def update
    @options.assign_attributes(options_params)
    if @options.valid? && @field.save(validate: false)
      redirect_to fields_url, notice: "Field was successfully updated."
    else
      render :edit
    end
  end

  private

  def set_options
    @options = @field.options
  end

  def options_params
    params.fetch(:options, {}).permit!
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
script_core-0.1.0 spec/dummy/app/controllers/fields/options_controller.rb
script_core-0.0.6 spec/dummy/app/controllers/fields/options_controller.rb
script_core-0.0.5 spec/dummy/app/controllers/fields/options_controller.rb