Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.3k
Fix CSV responses when index overriding with the call alias method#8031
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Fix CSV responses when index overriding with the call alias method#8031
Uh oh!
There was an error while loading.Please reload this page.
Conversation
0e3da46 to23be363Compare23be363 to0da137bCompare2b5cee9 to6775587CompareCodecov 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. |
mgrunberg commentedSep 26, 2024
@javierjulio this LGTM. What do you think? |
javierjulio commentedSep 27, 2024
@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 endend This 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 |
mgrunberg commentedSep 27, 2024
@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 in2692838
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.