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 CSV responses when index overriding with the call alias method #8031

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

megos
Copy link

@megos megos commented Jul 26, 2023

CSV responses are implemented by overriding the index as below.

def index
super do |format|
format.csv { stream_csv }
yield(format) if block_given?
end
end

If a user overrides the index using the alias method instead of the super, this implementation is ignored and CSV responses are not working.

controller do
  def index
    index! do |format| # Cause "No renderer defined for format: csv"
      ...
    end
  end
end

I add an alias method to make this implementation work anytime.

@megos megos force-pushed the fix-csv-responses-when-overriding-index branch from 0e3da46 to 23be363 Compare July 27, 2023 00:07
@javierjulio javierjulio force-pushed the fix-csv-responses-when-overriding-index branch from 23be363 to 0da137b Compare August 12, 2023 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant