Sha256: 735657e0f2ee9470aebc1afa0212740b06bd132785561feebdfd864a6d8814a6

Contents?: true

Size: 619 Bytes

Versions: 1

Compression:

Stored size: 619 Bytes

Contents

module AssignableValues
  module ActiveRecord
    module Restriction
      class ScalarAttribute < Base

        private

        def decorate_values(values)
          restriction = self
          values.collect do |value|
            if value.is_a?(String)
              value = value.dup
              value.singleton_class.send(:define_method, :human) do
                restriction.humanize_string_value(value)
              end
            end
            value
          end
        end

        def previously_saved_value(record)
          record.send("#{property}_was")
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
assignable_values-0.1.0 lib/assignable_values/active_record/restriction/scalar_attribute.rb