Sha256: 4cd04bee4f030f4ea0ac91ae1f0de08e5d70223d592cf21d7ff879c1edf80090

Contents?: true

Size: 471 Bytes

Versions: 1

Compression:

Stored size: 471 Bytes

Contents

require 'administrate/field/text'
require 'administrate/engine'

module Administrate
  module Field
    class Money < Administrate::Field::Text
      class Engine < ::Rails::Engine
        Administrate::Engine.add_javascript 'administrate-field-money/application'
      end

      def to_s
        money.format
      end

      def money
        @money ||= ::Money.new(data, code)
      end

      def code
        options.fetch(:code, 'USD')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
administrate-field-money-0.0.1 lib/administrate/field/money.rb