This project is archived and is in readonly mode.
ActiveResource : clone fails when the resource has Fixnum or boolean attributes
Reported by Pierre Lancien | December 19th, 2010 @ 05:36 PM
In ActiveResource::Base, the clone method raises an error whenever an attribute of the cloned resource is not cloneable.
class Person < ActiveResource::Base
self.site = "http://37s.sunrise.i:3000"
end
matz = Person.new(:name => 'Matz', :age => 31)
matz.clone
will raise :
TypeError: can't clone Fixnum
It's the same with boolean attributes.
Comments and changes to this ticket
-
Pierre Lancien December 19th, 2010 @ 05:46 PM
Here is the patch with the test.
Since it's my first submission, I'm not sure of doing things properly... but I'm here to learn! -
Stephen Heuer February 24th, 2011 @ 05:26 PM
- Tag set to rails 2.3.11, activeresource, patch
This fixes a problem I had when I tried upgrading from 2.3.10 to 2.3.11 with my app. Too bad this wasn't merged before 2.3.11 was released. I've attached an updated patch file.
can't clone Fixnum
/Users/sheuer/.rvm/gems/ruby-1.9.2-p136@arora/gems/activesupport-2.3.11/lib/active_support/duration.rb:97:in `clone' /Users/sheuer/.rvm/gems/ruby-1.9.2-p136@arora/gems/activesupport-2.3.11/lib/active_support/duration.rb:97:in `method_missing' /Users/sheuer/.rvm/gems/ruby-1.9.2-p136@arora/gems/rack-1.1.0/lib/rack/utils.rb:183:in `set_cookie_header!' /Users/sheuer/.rvm/gems/ruby-1.9.2-p136@arora/gems/actionpack-2.3.11/lib/action_controller/session/abstract_store.rb:199:in `call' /Users/sheuer/.rvm/gems/ruby-1.9.2-p136@arora/gems/activesupport-2.3.11/lib/active_support/cache/strategy/local_cache.rb:25:in `call' /Users/sheuer/.rvm/gems/ruby-1.9.2-p136@arora/gems/actionpack-2.3.11/lib/action_controller/failsafe.rb:26:in `call'
-
Stephen Heuer February 24th, 2011 @ 05:35 PM
Wait... I thought it fixed my problem... but it doesn't ... still the patch file works for 2.3.11
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
- 6171 ActiveResource: prefix attributes that are mass assigned are not readable and serializable. Warning - one of the tests I added triggers the bug I pre...