Sha256: 2bc66c2c7a47c93205d10af0c5d3e841db05427941d68f03cd6190c6be6e2eb8
Contents?: true
Size: 830 Bytes
Versions: 1
Compression:
Stored size: 830 Bytes
Contents
# frozen_string_literal: true class RoadCrew::EngineSettingsController < ActionController::Base include Motorhead::Controller layout false def index @engine_settings = JSON.parse(cookies['road_crew_engine_settings'].presence || '{}') all_engine_names = Rails::Engine.subclasses.select {|e| e < Motorhead::Engine}.map {|e| e.parent.name} - ['RoadCrew'] # enable by default (all_engine_names - @engine_settings.keys).each {|engine_name| @engine_settings[engine_name] = '1'} end def update_all # on, off = engines.partition {|k, v| v == '1'}.map {|a| a.map {|kv| kv.first}} engine_settings = JSON.parse(cookies['road_crew_engine_settings'].presence || '{}').merge params[:engine_setting] cookies['road_crew_engine_settings'] = engine_settings.to_json redirect_to request.referer end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
motorhead-0.5.0 | lib/motorhead/road_crew/app/controllers/road_crew/engine_settings_controller.rb |