decode

decode(json, options = {}) Class Public methods Parses a JSON string (JavaScript Object Notation) into a hash. See www.json.org for more info. ActiveSupport::JSON.decode("{\"team\":\"rails\",\"players\":\"36\"}") => {"team" => "rails", "players" => "36"}

inheritable_copy

inheritable_copy() Instance Public methods

new

new(parent = nil) Class Public methods

underscore

underscore(camel_cased_word) Instance Public methods Makes an underscored, lowercase form from the expression in the string. Changes '::' to '/' to convert namespaces to paths. 'ActiveModel'.underscore # => "active_model" 'ActiveModel::Errors'.underscore # => "active_model/errors" As a rule of thumb you can think of underscore as the inverse of camelize, though there are cases where that does not hold: 'SSLError'.underscore.camelize # => "SslError"

transliterate

transliterate(string, replacement = "?") Instance Public methods Replaces non-ASCII characters with an ASCII approximation, or if none exists, a replacement character which defaults to â?â. transliterate('Ãrøskøbing') # => "AEroskobing" Default approximations are provided for Western/Latin characters, e.g, âøâ, âñâ, âéâ, âÃâ, etc. This method is I18n aware, so you can set up custom approximations for a locale. This can be useful, for example, to transliterate German's âüâ

titleize

titleize(word) Instance Public methods Capitalizes all the words and replaces some characters in the string to create a nicer looking title. titleize is meant for creating pretty output. It is not used in the Rails internals. titleize is also aliased as titlecase. 'man from the boondocks'.titleize # => "Man From The Boondocks" 'x-men: the last stand'.titleize # => "X Men: The Last Stand" 'TheManWithoutAPast'.titleize # => "The Man Without A Past" 'raiders_of_the

tableize

tableize(class_name) Instance Public methods Create the name of a table like Rails does for models to table names. This method uses the pluralize method on the last word in the string. 'RawScaledScorer'.tableize # => "raw_scaled_scorers" 'egg_and_ham'.tableize # => "egg_and_hams" 'fancyCategory'.tableize # => "fancy_categories"

singularize

singularize(word, locale = :en) Instance Public methods The reverse of pluralize, returns the singular form of a word in a string. If passed an optional locale parameter, the word will be singularized using rules defined for that language. By default, this parameter is set to :en. 'posts'.singularize # => "post" 'octopi'.singularize # => "octopus" 'sheep'.singularize # => "sheep" 'word'.singularize # => "word" 'CamelOctopi'.si

safe_constantize

safe_constantize(camel_cased_word) Instance Public methods Tries to find a constant with the name specified in the argument string. 'Module'.safe_constantize # => Module 'Test::Unit'.safe_constantize # => Test::Unit The name is assumed to be the one of a top-level constant, no matter whether it starts with â::â or not. No lexical context is taken into account: C = 'outside' module M C = 'inside' C # => 'inside' 'C'.safe_constantize # => 'ou

pluralize

pluralize(word, locale = :en) Instance Public methods Returns the plural form of the word in the string. If passed an optional locale parameter, the word will be pluralized using rules defined for that language. By default, this parameter is set to :en. 'post'.pluralize # => "posts" 'octopus'.pluralize # => "octopi" 'sheep'.pluralize # => "sheep" 'words'.pluralize # => "words" 'CamelOctopus'.pluralize # => "CamelOctopi"