lib/active_configuration/setting_proxy.rb
# Saves this setting's modifiers and values.
#
# @return [Boolean] whether or not the save was successful.
Saves this setting's modifiers and values.
Saves this setting ' s modifiers and values .
def save
      save_status = true
      original_setting_ids = @manager.configurable.active_configuration_settings.with_key(@key).collect(&:id)
      replaced_setting_ids = []
      [value].flatten.each do |value_with_modifier|
        if (setting = @manager.configurable.active_configuration_settings.create(:key => @key, :modifier => value_with_modifier[:modifier], :value => value_with_modifier[:value])).new_record?
          save_status = false && break
        else
          replaced_setting_ids << setting.id
        end
      end
      @manager.configurable.active_configuration_settings.reload
      @manager.configurable.active_configuration_settings.with_key(@key).where(:id => (save_status ? original_setting_ids : replaced_setting_ids)).destroy_all
      @manager.settings.delete(@key)
      return save_status
    end
def save save_status = true original_setting_ids = @manager . configurable . active_configuration_settings . with_key ( @key ) . collect ( & :id ) replaced_setting_ids = [ ] [ value ] . flatten . each do | value_with_modifier | if ( setting = @manager . configurable . active_configuration_settings . create ( :key => @key , :modifier => value_with_modifier [ :modifier ] , :value => value_with_modifier [ :value ] ) ) . new_record? save_status = false && break else replaced_setting_ids << setting . id end end @manager . configurable . active_configuration_settings . reload @manager . configurable . active_configuration_settings . with_key ( @key ) . where ( :id => ( save_status ? original_setting_ids : replaced_setting_ids ) ) . destroy_all @manager . settings . delete ( @key ) return save_status end
Saves this setting's modifiers and values.
Saves this setting ' s modifiers and values .
whether or not the save was successful.
whether or not the save was successful .
Boolean