Sha256: 4660c2f167e0caa36362bf069ba788d65a759b94da1c7390ad3e4e7751627f27
Contents?: true
Size: 800 Bytes
Versions: 12
Compression:
Stored size: 800 Bytes
Contents
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
12 entries across 12 versions & 1 rubygems