Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch all models automatically when not specified in config #19

Open
simon-isler opened this issue Nov 8, 2024 · 0 comments
Open

Fetch all models automatically when not specified in config #19

simon-isler opened this issue Nov 8, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@simon-isler
Copy link
Member

simon-isler commented Nov 8, 2024

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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant