Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

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

Closed
lighthouse-import opened this Issue May 16, 2011 · 6 comments

Comments

Projects
None yet
2 participants

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.

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!

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

tagged:patch

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:inmethod_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:incall'
/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:incall'

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

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

Contributor

RKushnir commented Oct 26, 2011

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