Use StringInquirer for Readable Predicate Methods - Andy Croll
13-Feb-2026 360
You’ve probably seen Rails.env.production? in your codebase to ensure that certain code only runs in production. Instead of having to compare strings, Rails.env == "production", Rails wraps the string in an ActiveSupport::StringInquirer so you get readable methods like .production? and .development?.
Active Support also adds an inquiry method to String so you can use this same pattern in your own code.
Use StringInquirer for Readable Predicate Methods - Andy Croll #ruby #rubydeveloper #rubyonrails #StringInquirer #Readable #Predicate #Methods #Croll https://rubyonrails.ba/link/use-stringinquirer-for-readable-predicate-methods-andy-croll