Global Helpers
Global Helpers
capitalize()— Capitalizes the first letter of every word in the provided text, creating a nicely formatted title or sentence.controller()— The controller() function creates and returns a controller object with a custom name and optional parameters. It is primdeobfuscateParam()— Converts an obfuscated string back into its original value. This is typically used when IDs or other sensitive data aredistanceOfTimeInWords()— Pass in two dates to this method, and it will return a string describing the difference between them.excerpt()— excerpt() extracts a portion of text surrounding the first instance of a given phrase. This is useful for previews, searhumanize()— Converts a camel-cased or underscored string into more readable, human-friendly text by inserting spaces and capitalizinhyphenize()— Converts camelCase or PascalCase strings into lowercase hyphen-separated strings. Useful for generating URL-friendly slumimeTypes()— Returns the associated MIME type for a given file extension. Useful when serving files dynamically or setting response hmodel()— Returns a reference to a specific model defined in your application, allowing you to call class-level methods on it. ThiobfuscateParam()— Obfuscates a value, typically used to hide sensitive information like primary key IDs when passing them in URLs. This hepluginNames()— Returns a list of all installed Wheels plugins in your application. This can be useful if you want to check for the prespluralize()— Returns the plural form of the passed in word. Can also pluralize a word based on a value passed to thecount</codsingularize()— Converts a plural word into its singular form. It uses Wheels’ built-in inflection rules, handling common English pluraltimeAgoInWords()— Returns a human-friendly string describing the approximate time difference between two dates (defaults to comparing agaitimeUntilInWords()— Returns a human-readable string describing the approximate time difference between the current date (or another startingtitleize()— Converts a string so that the first letter of each word is capitalized, producing a cleaner, title-like appearance. It itruncate()— Shortens a given text string to a specified length and appends a replacement string (by default ”…”) at the end to indURLFor()— Generates an internal URL based on the supplied arguments. It can create URLs using a named route, or by specifying a cowordTruncate()— Truncates text to the specified length of words and replaces the remaining characters with the specified truncate string