Skip to content

Commit

Permalink
Merge pull request #19210 from lpichler/remove_value2tag_and_get_col_…
Browse files Browse the repository at this point in the history
…type_in_quote_method_of_miq_expression

Remove value2tag and get col type in quote method of MiqExpresion
  • Loading branch information
kbrock authored Aug 28, 2019
2 parents 69a5973 + 731f964 commit cade3a7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/miq_expression.rb
Original file line number Diff line number Diff line change
Expand Up @@ -642,9 +642,12 @@ def self.operands2rubyvalue(operator, ops, context_type)

def self.quote(val, typ)
if Field.is_field?(val)
ref, value = value2tag(val)
col_type = get_col_type(val) || "string"
return ref ? "<value ref=#{ref}, type=#{col_type}>#{value}</value>" : "<value type=#{col_type}>#{value}</value>"
target = parse_field_or_tag(val)
value = target.tag_path_with
col_type = target.try(:column_type) || "string"

reference_attribute = target ? "ref=#{target.model.to_s.downcase}, " : " "
return "<value #{reference_attribute}type=#{col_type}>#{value}</value>"
end
case typ.to_s
when "string", "text", "boolean", nil
Expand Down

0 comments on commit cade3a7

Please sign in to comment.