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

Fix bug with MainController#bulk_action #3407

Merged
merged 2 commits into from
Jan 22, 2022

Conversation

Art3606
Copy link
Contributor

@Art3606 Art3606 commented Oct 26, 2021

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

@@ -25,7 +25,7 @@ def #{action.action_name}
end

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
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
Member

Could you add a test for this fix?

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

coveralls commented Jan 22, 2022

Pull Request Test Coverage Report for Build 1732499667

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage remained the same at 95.845%

Files with Coverage Reduction New Missed Lines %
lib/rails_admin/config/actions.rb 2 74.03%
Totals Coverage Status
Change from base Build 1704020286: 0%
Covered Lines: 3645
Relevant Lines: 3803

💛 - Coveralls

@mshibuya
Copy link
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.

None yet

3 participants