This project is archived and is in readonly mode.
Fixture named accessors do not work when the fixture name is not the table name
Reported by Rhett Sutphin | May 6th, 2008 @ 05:05 PM
If you have a fixture name which does not match the table name for the associated model, the fixture named accessors will raise an exception like this:
NoMethodError: undefined method `[]' for nil:NilClass
The underlying cause is similar to ticket #8: @loaded_fixtures has values stored in it using the table name, but loaded using the fixture name. The attached patch (with test) fixes this.
(The test case is simpler than a real-life situation, but illustrates the problem. A real-life situation might involve prefixed/suffixed tables or tables in different schemas.)
Comments and changes to this ticket
-
Pratik May 19th, 2008 @ 11:09 AM
- State changed from new to incomplete
- Assigned user set to Pratik
Can you please rewrite the patch to use an existing table instead of creating a new table ?
Rest looks fine.
Thanks!
-
Rhett Sutphin May 21st, 2008 @ 10:58 PM
- no changes were found...
-
Rhett Sutphin May 22nd, 2008 @ 03:37 AM
Updated test to use existing table with a different model. Thanks for your review.
-
Pratik May 21st, 2008 @ 11:17 PM
- State changed from incomplete to open
-
Rhett Sutphin June 4th, 2008 @ 03:00 AM
- State changed from open to incomplete
The last change on this ticket indicates it went from incomplete to open, but the ticket summary still says "incomplete" and it is not showing up on the "open patches" report.
This is just a ping so that it doesn't get lost.
-
Pratik July 7th, 2008 @ 11:29 AM
- State changed from incomplete to open
- Tag set to activerecord, bug, fixtures, patch
-
Repository July 14th, 2008 @ 02:04 AM
- State changed from open to resolved
(from [d72c66532f959846cdc2d7fb1dc1ef6ba87bdcb1]) Make fixture accessors work when fixture name is not same as the table name. [#124 state:resolved]
Signed-off-by: Pratik Naik
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>