Class: Preflex::PreferencesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/preflex/preferences_controller.rb

Instance Method Summary collapse

Instance Method Details

#updateObject

POST /preferences

Params:
   klass
   name
   value


8
9
10
11
12
13
14
# File 'app/controllers/preflex/preferences_controller.rb', line 8

def update
  klass = params[:klass].constantize
  raise "Expected #{params[:klass]} to be a subclass of Preflex::Preference" unless klass < Preflex::Preference

  klass.set(params[:name], params[:value])
  head :ok
end