This project is archived and is in readonly mode.
[PATCH] Fix attr_accessor_with_default causing TypeError "singleton can't be dumped"
Reported by Serge Balyuk | June 6th, 2010 @ 12:35 PM
The current attr_accessor_with_default
implementation of writer method changes object's singleton class.
That does not work well with marshaling, and such objects can't be
easily put in memcache:
cache = MemCache.new('localhost:11211')
class C
attr_accessor_with_default :foo, 'bar'
end
c = C.new
cache.set('c', c) # ok
c.foo = 'hello'
cache.set('c', c) # /usr/lib/ruby/1.8/memcache.rb:300:in `dump': singleton can't be dumped (TypeError)
Please find proposed patch that changes
attr_accessor_with_default
implementation so that it
doesn't produce surprising changes in object singleton class.
Comments and changes to this ticket
-
Serge Balyuk June 6th, 2010 @ 12:41 PM
- no changes were found...
-
Serge Balyuk June 6th, 2010 @ 12:48 PM
- no changes were found...
-
Santiago Pastorino February 2nd, 2011 @ 04:37 PM
- State changed from new to open
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino February 2nd, 2011 @ 04:38 PM
- State changed from open to stale
-
Serge Balyuk March 20th, 2011 @ 01:30 PM
- State changed from stale to open
[state:open]
Per suggestion above, I've rebased against 3-0-stable and was able to successfully reproduce the issue in that branch.
Please find updated version of the patch attached.
-
Serge Balyuk March 20th, 2011 @ 02:45 PM
- Tag changed from activesupport, core_ext, fix, master, module, patch to 3x, activesupport, core_ext, fix, module, patch
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>