Class: Locomotive::CustomFields::SelectOptionsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Locomotive::CustomFields::SelectOptionsController
- Defined in:
- app/controllers/locomotive/custom_fields/select_options_controller.rb
Instance Method Summary collapse
Instance Method Details
#edit ⇒ Object
12 13 14 |
# File 'app/controllers/locomotive/custom_fields/select_options_controller.rb', line 12 def edit respond_with @custom_field end |
#new_option ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/controllers/locomotive/custom_fields/select_options_controller.rb', line 21 def new_option if params[:select_option].present? option = @custom_field..build(name: option_name_param) render partial: 'option', locals: { select_option: option } else head :unprocessable_entity end end |
#update ⇒ Object
16 17 18 19 |
# File 'app/controllers/locomotive/custom_fields/select_options_controller.rb', line 16 def update @options = service.(.map(&:to_h)) respond_with @custom_field, location: -> { last_saved_location!(default_back_location) } end |