Skip to content

Ask for confirmation before destroying ActiveRecord::Base objects in specific environments

License

Notifications You must be signed in to change notification settings

liepauls/carefully

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Carefully

Additional layer of security when performing actions through rails console in sensitive environments.

Installation

Add to Gemfile

gem 'carefully'

Run from terminal

rails g carefully

Optionally you can edit config in config/intializers/carefully.rb

Usage

Add this to models for which you want to be prompted when destroying it's instances:

include Carefully

You might as well include it in your ActiveRecord::Base wrapper class (like ApplicationRecord) to have it for all models.

Disabling the prompt

You can disable the prompting for blocks like this:

Carefully.allow_all do
  this.destroy
  that.destroy
  everything.destroy
end

None of these actions will require to be confirmed this way.

About

Ask for confirmation before destroying ActiveRecord::Base objects in specific environments

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages