Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #8538 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

[PATCH] Record identification fails when rendering partial on association collection

Reported by: kamal Assigned to: bitsweat
Priority: normal Milestone: 1.x
Component: ActiveRecord Version: edge
Severity: normal Keywords: tiny
Cc:

Description

This patch fixes the behaviour of ActionView::Partials#render_partial when the partial_path is an association collection. E.g.

render :partial => @topic.replies

I think the reason it fails is because of the redifinition of === in ActiveRecord::Associations::AssociationProxy, which fails to match case partial_path ... when Array in #render_partial. This patch also adds tests for render :partial with record identification in general which I found lacking.

Attachments

render_partial_with_record_identification_fix.patch (3.2 kB) - added by kamal on 06/01/07 02:35:55.
patch and tests

Change History

06/01/07 02:35:55 changed by kamal

  • attachment render_partial_with_record_identification_fix.patch added.

patch and tests

06/01/07 02:54:21 changed by kamal

Just to add more info, because we fail to match when Array, it goes into the else block and record identification mis-identifies the template path as 'arrays/_array'.

06/01/07 03:53:43 changed by bitsweat

  • status changed from new to closed.
  • resolution set to fixed.

(In [6920]) render :partial recognizes Active Record associations as Arrays. Closes #8538.