lib/cm_admin/models/column.rb in cm-admin-0.6.6 vs lib/cm_admin/models/column.rb in cm-admin-0.6.7

- old
+ new

@@ -25,33 +25,9 @@ self.managable = true self.lockable = false self.tag_class = {} end - #formatting value for different data types - def self.format_data_type(column, value) - case column.column_type - when :string - if column.format.present? - column.format = [column.format] if column.format.is_a? String - column.format.each do |formatter| - value = value.send(formatter) - end - end - when :datetime - format_value = column.format.present? ? column.format.to_s : '%d/%m/%Y' - value = value.strftime(format_value) - when :enum - value = value.titleize - when :decimal - round_to = column.round.present? ? column.round.to_i : 2 - value = value.round(round_to) - when :custom - - end - return value - end - class << self def find_by(model, search_hash) model.available_fields.find { |i| i.name == search_hash[:name] } end end