Skip to content
This repository

ActiveResource : clone fails when the resource has Fixnum or boolean attributes #793

Closed
lighthouse-import opened this Issue · 6 comments

2 participants

Lighthouse Import
Lighthouse Import

Imported from Lighthouse. Original ticket at: http://rails.lighthouseapp.com/projects/8994/tickets/6195
Created by Pierre Lancien - 2011-03-29 01:29:20 UTC

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.

Lighthouse Import

Imported from Lighthouse.
Comment by Pierre Lancien - 2010-12-19 17:46:29 UTC

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!

Lighthouse Import

Imported from Lighthouse.
Comment by Pierre Lancien - 2010-12-19 18:25:16 UTC

tagged:patch

Lighthouse Import

Imported from Lighthouse.
Comment by Stephen Heuer - 2011-02-24 17:26:34 UTC

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'

Lighthouse Import

Imported from Lighthouse.
Comment by Stephen Heuer - 2011-02-24 17:35:28 UTC

Wait... I thought it fixed my problem... but it doesn't ... still the patch file works for 2.3.11

Lighthouse Import

Attachments saved to Gist: http://gist.github.com/971754

Is it ever going to be accepted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.