Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

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

#6195

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.

Reported by Pierre Lancien · December 19th, 2010 @ 05:36 PM

State: new
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Pierre Lancien
    Pierre Lancien

    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!

    December 19th, 2010 @ 05:46 PM

  2. Pierre Lancien
  3. Stephen Heuer
    Stephen Heuer
    • 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'
    

    February 24th, 2011 @ 05:26 PM

  4. Stephen Heuer
    Stephen Heuer

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

    February 24th, 2011 @ 05:35 PM