Skip to content

Follow-up from "Fix bug where create MR toggle wasn't inspected correctly"

The following discussion from !139047 (merged) should be addressed:

Looking at !139047 (comment 1703639433), I think perhaps we could follow-up in a separate issue regarding ActiveModel::Type::Boolean.new.cast vs Gitlab::Utils.to_boolean.

➜  gitlab git:(sc1-buffered-counter-migrate) ✗ rg ActiveModel::Type::Boolean
ee/spec/support/llm.rb
5:    real_ai_request_bool = ActiveModel::Type::Boolean.new.cast(ENV['REAL_AI_REQUEST'])

ee/app/models/concerns/identity_verifiable.rb
93:      ActiveModel::Type::Boolean.new.cast(phone_number_exemption_attribute.value)

app/models/concerns/cascading_namespace_setting_attribute.rb
259:    ActiveModel::Type::Boolean.new.cast(value)

I see only 4 instances (inclusive of this) where ActiveModel::Type::Boolean.new so perhaps the issue could target the entire project as to whether we should favour Gitlab::Utils.to_boolean over ActiveModel::Type::Boolean.

This is not blocking so as they are both functionally correct and battle-tested (one in Rails and one in GitLab) I'm setting auto-merge.