Class: Madmin::Fields::Currency

Inherits:
Madmin::Field show all
Defined in:
lib/madmin/fields/currency.rb

Instance Attribute Summary

Attributes inherited from Madmin::Field

#attribute_name, #model, #options, #resource

Instance Method Summary collapse

Methods inherited from Madmin::Field

#default_index_attributes, field_type, #initialize, #required?, #to_param, #to_partial_path, #visible?

Constructor Details

This class inherits a constructor from Madmin::Field

Instance Method Details

#searchable?Boolean

Returns:



10
11
12
# File 'lib/madmin/fields/currency.rb', line 10

def searchable?
  options.fetch(:searchable, model.column_names.include?(attribute_name.to_s))
end

#value(record) ⇒ Object



4
5
6
7
8
# File 'lib/madmin/fields/currency.rb', line 4

def value(record)
  value = record.public_send(attribute_name)
  value /= 100.0 if value && options.minor_units
  value
end