Namespace
Methods
Instance Public methods
normalize_attribute(name) Link
Normalizes a specified attribute using its declared normalizations.
Examples
class User < ActiveRecord::Base
normalizes :email, with: -> email { email.strip.downcase }
end
legacy_user = User.find(1)
legacy_user.email # => " CRUISE-CONTROL@EXAMPLE.COM\n"
legacy_user.normalize_attribute(:email)
legacy_user.email # => "cruise-control@example.com"
legacy_user.save