ActionableError
Some of the code used:
class MissingSeedsError < StandardError
include ActiveSupport::ActionableError
action "Run db:seeds" do
Rails.application.load_seed
end
end
ApplicationController < ActionController::Base
before_action :check_db_seeds, if: -> { Rails.env.development? }
def check_db_seeds
raise MissingSeedsError if User.count.zero?
end
end
ActiveSupport::ActionableError.dispatch(TestError, "Say Hello!")
ActiveSupport::ActionableError.actions(TestError)
ActiveSupport::ActionableError.actions(ActiveRecord::PendingMigrationError)