Skip to content
This repository has been archived by the owner on Jun 6, 2020. It is now read-only.

youtous/auto_format_attributes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AutoFormatAttributes

AutoFormatAttributes helps to format string attributes from ActiveRecord or ActiveModel.

It works by adding a before_validation hook to the record.

Usage

class User < ActiveRecord::Base

  # the last name will be in UPPERCASE
  auto_upcase_attributes :last_name

  auto_capitalize_attributes :name, :first_name

  auto_downcase_attributes :profile_url
  
  auto_titleize_attributes :title
end

Installation

Add this line to your application's Gemfile:

gem 'auto_format_attributes'

And then execute:

$ bundle

Or install it yourself as:

$ gem install auto_format_attributes

License

The gem is available as open source under the terms of the MIT License.

About

Gem providing an easy way to format strings attributes before the validation in ActiveModel.

Resources

License

Stars

Watchers

Forks

Packages

No packages published