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

Ticket #10183 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

[PATCH] Support polymorphic fixture foxiness

Reported by: jbarnette Assigned to: core
Priority: normal Milestone: 2.x
Component: ActiveRecord Version: edge
Severity: normal Keywords: verified
Cc:

Description

The attached patch allows polymorphic belongs_to associations to be specified foxily, e.g.,

# instead of saying
foo:
  pet_id: 1 # a pet fixture labelled "horace"
  pet_type: Ferret

# you can say
foo:
  pet: horace (Ferret)

Attachments

polyfoxy.diff (4.3 kB) - added by jbarnette on 11/16/07 04:40:03.

Change History

11/16/07 04:40:03 changed by jbarnette

  • attachment polyfoxy.diff added.

11/16/07 04:42:28 changed by jbarnette

Doh! I meant to mention: This feature was suggested by David Lowenfels, who provided a very similar feature patch for Rathole. Thanks, David!

11/16/07 05:04:23 changed by jbarnette

  • milestone changed from 2.0 to 2.x.

11/17/07 18:31:12 changed by danger

That there syntax is a real nice'uh.

+1

11/19/07 00:37:56 changed by revans

+1

11/19/07 23:19:17 changed by rmm5t

  • keywords set to verified.

+1 patch applies cleanly, tests pass

11/20/07 21:53:31 changed by nzkoz

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

(In [8170]) Add 'foxy' support for fixtures of polymorphic associations. Closes #10183 [jbarnette, David Lowenfels]