Sha256: c8dab0d27d290b8b24f52a3ab628c20f135d1866651a379bd218e8922bf1c62a

Contents?: true

Size: 776 Bytes

Versions: 1

Compression:

Stored size: 776 Bytes

Contents

module StateFu
  module Persistence
    class ActiveRecord < StateFu::Persistence::Base

      def self.prepare_field( klass, field_name )
        _field_name = field_name
        klass.send :before_save, :state_fu!
        # validates_presence_of _field_name
      end

      private

      # We already checked that they exist, or we'd be using the
      # Attribute version, so just do the simplest thing we can.

      def read_attribute
        object.send( :read_attribute, field_name )
      end

      def write_attribute( string_value )
        # Logger.warn(" :write_attribute,#{ field_name},#{ string_value} \n=========================================================")
        object.send( :write_attribute, field_name, string_value )
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
davidlee-state-fu-0.2.0 lib/state_fu/persistence/active_record.rb