Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-25 18:50:27 +01:00
FIX: cast both key and value as boolean if operator is `is:[true|false]
`
Dieser Commit ist enthalten in:
Ursprung
774cf70efc
Commit
805e934fdf
1 geänderte Dateien mit 5 neuen und 1 gelöschten Zeilen
|
@ -143,7 +143,7 @@ class CustomWizard::Mapper
|
||||||
if value == "present"
|
if value == "present"
|
||||||
result = key.public_send(operator)
|
result = key.public_send(operator)
|
||||||
elsif ["true", "false"].include?(value)
|
elsif ["true", "false"].include?(value)
|
||||||
result = key.public_send(operator, ActiveRecord::Type::Boolean.new.cast(value))
|
result = bool(key).public_send(operator, bool(value))
|
||||||
end
|
end
|
||||||
elsif [key, value, operator].all? { |i| !i.nil? }
|
elsif [key, value, operator].all? { |i| !i.nil? }
|
||||||
result = key.public_send(operator, value)
|
result = key.public_send(operator, value)
|
||||||
|
@ -265,4 +265,8 @@ class CustomWizard::Mapper
|
||||||
result = data[k]
|
result = data[k]
|
||||||
keys.empty? ? result : self.recurse(result, keys)
|
keys.empty? ? result : self.recurse(result, keys)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bool(value)
|
||||||
|
ActiveRecord::Type::Boolean.new.cast(value)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Laden …
In neuem Issue referenzieren