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

The <partial_name>_iteration local is missing when rendering heterogeneous collections #27794

Closed
meagar opened this issue Jan 24, 2017 · 0 comments

Comments

@meagar
Copy link
Contributor

meagar commented Jan 24, 2017

Steps to reproduce

  • In a controller, create a heterogeneous array of objects responding to to_partial_path, such as a set of ActiveRecord models in an STI hierarchy, and assign it to @collection
  • Render the collection using render @collection or render partial: @collection
  • Attempt to use <template_name>_iteration in the rendered partial, and find that it isn't defined

See https://github.com/meagar/partial-iteration-test for a simple POC, specifically the commit that introduces the bug and screenshots of the broken/expected behavior.

Expected behavior

A variable named <partial_name>_iteration should be set to an instance of ActionView::PartialIteration

Actual behavior

The variable is unset

System configuration

Rails version:

Rails 5.0.1

Ruby version:

ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants