Skip to content
This repository was archived by the owner on Jun 17, 2025. It is now read-only.
mattdennerPublic archive

About

Adds warnings to ActiveRecord so that validations can be used

Resources

Stars

4 stars

Watchers

1 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

ActiveRecord Warnings

This gem adds support for warnings to ActiveRecord::Base instances. Warnings do not fail the record being saved but should be presented to the user. The warnings work through the standard validation mechanism.

To add warnings to your model:

class MyModel < ActiveRecord::Base
  warnings do
    validates_presence_of :name
  end
end

x = MyModel.create!
x.warnings? # => true
x.warnings.on(:name) # => "can't be blank"

Any validation calls within the warnings block will be classed as a warning. The warnings method returns an ActiveRecord::Errors instance, just as the default errors implementation does.

About

Adds warnings to ActiveRecord so that validations can be used

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages