Class: Backend::SettingsController

Inherits:
BaseController show all
Defined in:
app/controllers/backend/settings_controller.rb

Instance Attribute Summary

Attributes inherited from ApplicationController

#current_theme

Instance Method Summary collapse

Methods inherited from BaseController

accounts_range_crit, crit_params, journal_entries_states_crit, journal_period_crit, journals_crit, search_conditions

Methods inherited from ApplicationController

#after_sign_in_path_for, #authorized?, human_action_name, #human_action_name

Instance Method Details

#aboutObject


42
43
44
45
46
# File 'app/controllers/backend/settings_controller.rb', line 42

def about
  @properties = []
  @properties.insert(0, ['Ekylibre version', Ekylibre.version])
  @properties << ['Database version', ActiveRecord::Migrator.current_version]
end

#editObject


21
22
23
# File 'app/controllers/backend/settings_controller.rb', line 21

def edit
  Preference.check!
end

#updateObject


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/backend/settings_controller.rb', line 25

def update
  saved = true
  ActiveRecord::Base.transaction do
    for key, data in params[:preferences]
      preference = Preference.get!(key)
      if preference
        preference.value = data[:value]
        preference.save
      else
        saved = false
      end
    end
  end
  redirect_to_back && return if saved
  render :edit
end