Possible Rails 2.1.0 issue using the Object's send method

Code like the following worked fine under Rails 2.0.2 but now throws an
exception under Rails 2.1.0. Has anyone else had this issue?

class BugTest < ActiveRecord::Base
def set_name(value)
send(“name=”, value)
end
end

Here’s the exception…

NoMethodError: You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.include?
/vendor/rails/activerecord/lib/active_record/dirty.rb:126:in
`write_attribute’

I came across this upgrading a site to Rails 2.1. In my case it was
attribute change tracking stuff in Rails not playing nicely with the
acts_as_versioned plugin which does something similar. The latest
version of the plugin sort this, grab it with something like “script/
plugin install git://github.com/technoweenie/acts_as_versioned.git”.

I came across this upgrading a site to Rails 2.1. In my case it was
attribute change tracking stuff in Rails not playing nicely with the
acts_as_versioned plugin which does something similar. The latest
version of the plugin sort this, grab it with something like “script/
plugin install git://github.com/technoweenie/acts_as_versioned.git”.

[email protected] wrote:

I came across this upgrading a site to Rails 2.1. In my case it was
the attribute change tracking stuff in Rails not playing nicely with
the acts_as_versioned plugin, which does something similar. The latest
version of the plugin sorts this, grab it with something like “script/
plugin install git://github.com/technoweenie/acts_as_versioned.git”.

Do you know how this problem was solved or shall I dive into the
acts_as_versioned code?

  • Jason

I think acts_as_versioned was extending ActiveRecord with its own
changed_attributes collection. I was hoping you’d be using the plugin,
but if not then yeah, I guess you could jump in the code.

I came across this upgrading a site to Rails 2.1. In my case it was
the attribute change tracking stuff in Rails not playing nicely with
the acts_as_versioned plugin, which does something similar. The latest
version of the plugin sorts this, grab it with something like “script/
plugin install git://github.com/technoweenie/acts_as_versioned.git”.