Fix CSV responses when index overriding with the call alias method#8031
Fix CSV responses when index overriding with the call alias method#8031megos wants to merge 2 commits intoactiveadmin:masterfrom
Conversation
0e3da46 to
23be363
Compare
23be363 to
0da137b
Compare
2b5cee9 to
6775587
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8031 +/- ##
=======================================
Coverage 99.11% 99.11%
=======================================
Files 141 141
Lines 4069 4070 +1
=======================================
+ Hits 4033 4034 +1
Misses 36 36 ☔ View full report in Codecov by Sentry. |
|
@javierjulio this LGTM. What do you think? |
|
@mgrunberg not quite. It's why I held off but left this here as I'd like to see it resolved. I'm just not sure what the solution should be. I encountered this too the year before and resolved by calling controller do
def index
params[:some_flag] = "blah"
- index!
+ super
end
endThis is puzzling because I'm not sure why we are getting a new action method if InheritedResources would be defining this alias anyway since the Base applies the Actions module. Can you check if the controller has protected methods for I'd like to see tests that have a custom index action that does something, e.g. set a param, before calling |
|
@javierjulio thanks for the feedback. I need some time to think about your comment. I'll come back to this in a few days. I don't discard even copy this PR as an "in repo". |
CSV responses are implemented by overriding the index as below.
activeadmin/lib/active_admin/resource_controller/streaming.rb
Lines 12 to 17 in 2692838
If a user overrides the index using the alias method instead of the super, this implementation is ignored and CSV responses are not working.
I add an alias method to make this implementation work anytime.