As I was working on https://github.com/bullet-train-co/bullet_train-core/pull/776, I figured it would make sense to super scaffold bulk_action_select when we create a new action, as opposed to just having it show for all models whenever bullet_train-action_models is enabled.
The reason being that the we only use the bulk select when performing an action. Right now we just apply the partial to all models, even when there are no actions to perform on it (Refer to the hide_actions conditional in the files in https://github.com/bullet-train-co/bullet_train-core/pull/776).
We could go with one of two options
Extend the bulk select to delete records, or to do any other processing that would make sense to include in standard Bullet Train applications. Then we could remove the hide_actions conditional altogether.
Only scaffold the bulk select partial when super scaffolding a new action.
If we go with option two, I think we could add a method in the base scaffolder, lib/scaffolding/action_model_transformer.rb, and then call it for each Action which requires it (i.e. - TargetsMany).
def scaffold_bulk_action_select(file_name)
transformed_file_name = transform(file_name)
file_content = File.read(transformed_file_name)
block_manipulator = Scaffolding::BlockManipulator.new(transformed_file_name)
# Then insert `<%= render 'shared/bulk_action_select' %>` above the proper Action Models scaffolding hook
end
As I was working on https://github.com/bullet-train-co/bullet_train-core/pull/776, I figured it would make sense to super scaffold
bulk_action_select
when we create a new action, as opposed to just having it show for all models wheneverbullet_train-action_models
is enabled.The reason being that the we only use the bulk select when performing an action. Right now we just apply the partial to all models, even when there are no actions to perform on it (Refer to the
hide_actions
conditional in the files in https://github.com/bullet-train-co/bullet_train-core/pull/776).We could go with one of two options
hide_actions
conditional altogether.If we go with option two, I think we could add a method in the base scaffolder,
lib/scaffolding/action_model_transformer.rb
, and then call it for each Action which requires it (i.e. -TargetsMany
).