Backport
ActiveRecord::Normalization
to::ActiveModel::Attributes::Normalization
class User include ActiveModel::Attributes include ActiveModel::Attributes::Normalization attribute :email, :string normalizes :email, with: -> email { email.strip.downcase } end user = User.new user.email = " CRUISE-CONTROL@EXAMPLE.COM\n" user.email # => "cruise-control@example.com"
Sean Doyle
Please check [8-0-stable]) for previous changes.