Skip to content

Fetch all models automatically when not specified in config #19

Description

@sislr

currently we only load models that are defined in the configuration.

# frozen_string_literal: true

Hotsheet.configure do |config|
  config.model :Author do |model|
    model.included_attributes = %i[name birthdate gender created_at]
  end

  config.model :Post do |model|
    model.excluded_attributes = %i[id author_id created_at updated_at]
  end

  config.model :TableNameTest do |model|
    model.included_attributes = %i[]
  end

  config.model :VeryLongModelNameForOverflowTest do
    nil
  end
end

in this case, we would only show the configured models in the web.

so, it would be nice to have two additional global settings:

  • config.included_models
  • config.excluded_model

the following table shows an example which models should be configured depending on the included_models and excluded_models config settings:

included_models excluded_models ActiveRecord models
nil nil fetch all
["Author"] nil or [] only "Author"
[] nil or [] nothing, due to empty included_models
nil ["Author"] fetch all except "Author"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions