lib/generators/dry_crud/templates/app/helpers/standard_helper.rb
# Formats an arbitrary attribute of the given object depending on its data type.
# For ActiveRecords, take the defined data type into account for special types
# that have no own object class.
Formats an arbitrary attribute of the given object depending on its data type.
For ActiveRecords, take the defined data type into account for special types
that have no own object class.
Formats an arbitrary attribute of the given object depending on its data type . For ActiveRecords take the defined data type into account for special types that have no own object class .
def format_type(obj, attr)
    val = obj.send(attr)
    return EMPTY_STRING if val.nil?
    case column_type(obj, attr)
      when :time    then f(val.to_time)
      when :date    then f(val.to_date)
      when :datetime, :timestamp then "#{f(val.to_date)} #{f(val.time)}"
      when :text    then val.present? ? simple_format(h(val)) : EMPTY_STRING
      when :decimal then f(val.to_s.to_f)
      else f(val)
    end
  end
def format_type ( obj , attr ) val = obj . send ( attr ) return EMPTY_STRING if val . nil? case column_type ( obj , attr ) when :time then f ( val . to_time ) when :date then f ( val . to_date ) when :datetime , :timestamp then "#{f(val.to_date)} #{f(val.time)}" when :text then val . present? ? simple_format ( h ( val ) ) : EMPTY_STRING when :decimal then f ( val . to_s . to_f ) else f ( val ) end end
Formats an arbitrary attribute of the given object depending on its data type.
Formats an arbitrary attribute of the given object depending on its data type .
obj
attr