Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20:29 +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"
|
||||
result = key.public_send(operator)
|
||||
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
|
||||
elsif [key, value, operator].all? { |i| !i.nil? }
|
||||
result = key.public_send(operator, value)
|
||||
|
@ -265,4 +265,8 @@ class CustomWizard::Mapper
|
|||
result = data[k]
|
||||
keys.empty? ? result : self.recurse(result, keys)
|
||||
end
|
||||
|
||||
def bool(value)
|
||||
ActiveRecord::Type::Boolean.new.cast(value)
|
||||
end
|
||||
end
|
||||
|
|
Laden …
In neuem Issue referenzieren