Skip to content

Fix bug with MainController#bulk_action #3407

Merged
mshibuya merged 2 commits into
railsadminteam:masterfrom
Art3606:bulk_action_fix
Jan 22, 2022
Merged

Fix bug with MainController#bulk_action #3407
mshibuya merged 2 commits into
railsadminteam:masterfrom
Art3606:bulk_action_fix

Conversation

@Art3606

@Art3606 Art3606 commented Oct 26, 2021

Copy link
Copy Markdown
Contributor

For checking if action exists, was used :all scope instead of :bulkable. Because of this, will-called all policy methods which possibly can raise some errors


def bulk_action
send(params[:bulk_action]) if params[:bulk_action].in?(RailsAdmin::Config::Actions.all(controller: self, abstract_model: @abstract_model).select(&:bulkable?).collect(&:route_fragment))
send(params[:bulk_action]) if params[:bulk_action].in?(RailsAdmin::Config::Actions.all(:bulkable, controller: self, abstract_model: @abstract_model).select(&:bulkable?).collect(&:route_fragment))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.select(&:bulkable?) is no longer necessary, right?

@mshibuya

Copy link
Copy Markdown
Member

Could you add a test for this fix?

@mshibuya mshibuya added this to the 3.0.0 milestone Dec 26, 2021
@coveralls

coveralls commented Jan 22, 2022

Copy link
Copy Markdown

Coverage Status

Changes unknown
when pulling ee51f48 on Art3606:bulk_action_fix
into ** on railsadminteam:master**.

@mshibuya

Copy link
Copy Markdown
Member

This shouldn't be considered as the fix for issue #3404 (just happens to go around it in your setup), but the fix itself makes sense.
After merging in I'll add a test, thanks.

@mshibuya mshibuya merged commit 7cbdddd into railsadminteam:master Jan 22, 2022
mshibuya added a commit that referenced this pull request Jan 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants