Skip to content
This repository was archived by the owner on May 22, 2024. It is now read-only.

A gem that makes better dependent error messages telling exactly which relationship tree failed with which ID's.

License

Notifications You must be signed in to change notification settings

Agreena-ApS/active_record_better_dependent_error_messages

 
 

Repository files navigation

ActiveRecordBetterDependentErrorMessages

Short description and motivation.

Usage

How to use my plugin.

Installation

Add this line to your application's Gemfile:

gem "active_record_better_dependent_error_messages"

And then execute:

$ bundle

Or install it yourself as:

$ gem install active_record_better_dependent_error_messages

Include it in the models where you want it to inspect the relationships upon destroy like this:

class MyModel < ApplicationRecord
  include ActiveRecordBetterDependentErrorMessages::DestroyModule
end

You can add a custom error message like this:

en:
  activerecord:
    errors:
      models:
        user:
          attributes:
            base:
              cannot_delete_because_of_restriction: Cannot delete because the user has dependent %{association_name}

Contributing

Contribution directions go here.

License

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

About

A gem that makes better dependent error messages telling exactly which relationship tree failed with which ID's.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 79.1%
  • HTML 13.1%
  • JavaScript 4.5%
  • CSS 3.3%