Sha256: c618642d7297facca45a65903a42dd1f7f1d45491e27a260d175107062fb3ce1

Contents?: true

Size: 562 Bytes

Versions: 3

Compression:

Stored size: 562 Bytes

Contents

module ConfigureMe
  class Base
    extend ActiveModel::Callbacks
    define_model_callbacks :save
  end
  module Persistence

    def save(*)
      run_callbacks :save do
        persist_guard do
          temp_attributes.each_pair do |k,v|
            write_persist(k, v)
          end
        end
        temp_attributes.each_pair do |k,v|
          write_cache(k, v)
        end
        make_clean
      end
    end

    def update_attributes(new_attrs)
      new_attrs.each_pair do |k,v|
        write_attribute(k, v)
      end
      save
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
configure_me-0.5.0 lib/configure_me/persistence.rb
configure_me-0.4.1 lib/configure_me/persistence.rb
configure_me-0.4.0 lib/configure_me/persistence.rb