Render and default content type. #11393

Closed
GBH opened this Issue Jul 10, 2013 · 3 comments

Comments

Projects
None yet
4 participants
@GBH
Contributor

GBH commented Jul 10, 2013

Rails Guides claim that unless specified otherwise content_type is defaulted to text/html. See http://guides.rubyonrails.org/layouts_and_rendering.html#the-content-type-option

However actual implementation does this:

context.rendered_format = template.formats.first || formats.last

As a result render :inline => 'whatever' will be served up as a zip file. Don't think it's supposed to do this.

@GBH GBH referenced this issue in comfy/comfortable-mexican-sofa Jul 10, 2013

Closed

Fix preview format (rails 4) #322

@glebm

This comment has been minimized.

Show comment Hide comment
@glebm

glebm Jul 10, 2013

Contributor

+1, it should be formats.first not .last

Contributor

glebm commented Jul 10, 2013

+1, it should be formats.first not .last

@steveklabnik

This comment has been minimized.

Show comment Hide comment
@steveklabnik

steveklabnik Jul 10, 2013

Member

If you change it to .last, does it fail any tests? Serving it as zip seems bad.

Member

steveklabnik commented Jul 10, 2013

If you change it to .last, does it fail any tests? Serving it as zip seems bad.

@kennyj

This comment has been minimized.

Show comment Hide comment
@kennyj

kennyj Jul 14, 2013

Contributor

Hi guys. I've submitted pull request about this problem.

Contributor

kennyj commented Jul 14, 2013

Hi guys. I've submitted pull request about this problem.

guilleiguaran added a commit that referenced this issue Jul 14, 2013

Merge pull request #11437 from kennyj/fix_11393
Fix #11393. Fix default rendered format when calling render method without :content_type option.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment