This project is archived and is in readonly mode.
[Patched] ActiveModel::Serialization Documentation Example Fix
Reported by Nathaniel Bibler | January 2nd, 2011 @ 02:11 AM
The documentation for ActiveModel::Serialization
begins with an incredibly poor example of how to implement a the
ActiveModel#attributes method. The hash generated does not
correctly provide the local instance values and it memoizes the
result - which, that alone is already a very poor
practice.
Comments and changes to this ticket
-
Nathaniel Bibler January 2nd, 2011 @ 02:15 AM
Attached is a patch to remove the memoization from the example, as well as correctly return the attribute value in the generated hash.
-
Nathaniel Bibler January 2nd, 2011 @ 02:15 AM
- Title changed from ActiveModel::Serialization Documentation Example Fix to [Patched] ActiveModel::Serialization Documentation Example Fix
- Tag changed from activemodel, documentation, serialization to activemodel, documentation, patch, serialization
-
Nathaniel Bibler January 2nd, 2011 @ 02:27 AM
- Tag changed from activemodel, documentation, patch, serialization to activemodel, doc, documentation, patch, serialization
-
Tyler Hunt January 3rd, 2011 @ 01:13 PM
+1, although ideally the serializers would actually use the values from the attributes hash, rather than just the taking the keys and using #send to get the values.
-
Santiago Pastorino February 4th, 2011 @ 03:03 PM
- State changed from new to resolved
- Importance changed from to Low
Hey Nathaniel, do you mind to go ahead and push that to http://github.com/lifo/docrails ?
Thanks. -
Repository February 7th, 2011 @ 04:48 PM
- State changed from resolved to committed
(from [285fdbae2bafd5de415a685b57af36254197348c]) Fixed broken, memoized attributes method example
[#6245 state:committed]
Signed-off-by: Santiago Pastorino santiago@wyeworks.com
https://github.com/rails/rails/commit/285fdbae2bafd5de415a685b57af3... -
Nathaniel Bibler February 8th, 2011 @ 01:55 AM
Awesome, glad you liked the patch. Thanks for the commit, Santiago. :)
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>
People watching this ticket
Attachments
Referenced by
- 6245 [Patched] ActiveModel::Serialization Documentation Example Fix [#6245 state:committed]