Class: Redmine::FieldFormat::Numeric

Inherits:
Unbounded show all
Defined in:
lib/redmine/field_format.rb

Direct Known Subclasses

FloatFormat, IntFormat

Instance Method Summary collapse

Methods inherited from Unbounded

#validate_single_value

Methods inherited from Base

#before_custom_field_save, #bulk_edit_tag, #cast_custom_value, #cast_single_value, #cast_value, #edit_tag, field_attributes, #formatted_custom_value, #formatted_value, #group_statement, #join_for_order_statement, #label, #name, #possible_custom_value_options, #possible_values_options, #query_filter_options, #target_class, #validate_custom_field, #validate_custom_value, #validate_single_value

Methods included from I18n

#current_language, #day_letter, #day_name, #find_language, #format_date, #format_time, included, #l, #l_hours, #l_or_humanize, #languages_options, #ll, #month_name, #set_language_if_valid, #valid_languages

Instance Method Details

#order_statement(custom_field) ⇒ Object


350
351
352
353
354
355
# File 'lib/redmine/field_format.rb', line 350

def order_statement(custom_field)
  # Make the database cast values into numeric
  # Postgresql will raise an error if a value can not be casted!
  # CustomValue validations should ensure that it doesn't occur
  "CAST(CASE #{join_alias custom_field}.value WHEN '' THEN '0' ELSE #{join_alias custom_field}.value END AS decimal(30,3))"
end