module Records::Base

def all_blank?(attributes = {})

def all_blank?(attributes = {})
  attributes = self.attributes if attributes.empty?
  attributes.all? do |key, value|
    key == "_destroy" || value.blank? ||
      value.is_a?(Hash) && all_blank?(value) ||
      value.is_a?(Array) && value.all? { |val| all_blank?(val) }
  end
end

def label_attribute

by default we represent methods by their first string attribute.
def label_attribute
  columns_hash.values.find { |column| column.sql_type_metadata.type == :string }&.name
end

def label_string

identify them.
this is a template method you can override in activerecord models if we shouldn't just use their first string to
def label_string
  if (label_attribute = self.class.label_attribute)
    send("#{label_attribute}_was")
  else
    self.class.name.underscore.split("/").last.titleize
  end
end

def parent_collection

def parent_collection
  # TODO Try to suggest what the entire method definition should actually be
  # using parent_key below to do so.
  model_name = self.class
  # parent_key = model_name.reflect_on_all_associations(:belongs_to).first.name
  raise "You're trying to use a feature that requires #{model_name} to have a `collection` method defined that returns the Active Record association that this model belongs to within its parent object."
end

def seeding?

def seeding?
  Rake::Task.task_defined?("db:seed") && Rake::Task["db:seed"].already_invoked
end