Ticket #31 (new defect)

Opened 1 year ago

attr_accessible and better_nested_set seem to clash

Reported by: rails Assigned to: jcm
Priority: major Milestone:
Component: plugin Version: trunk
Keywords: Cc: someguy@iprog.com

Description

if i use attr_accessible :field1 and then run Model.new('field2' => 'value') it results in this:

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.each

from /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1671:in `attributes=' from /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1505:in `initialize_without_callbacks' from /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/callbacks.rb:225:in `initialize' from (irb):1:in `new' from (irb):1

executing just Model.new, without any parameters still works. removing acts_as_nested_set from my model declaration resolves the issue. so does replacing attr_accessible with attr_protected and listing every field that wasn't listed for attr_accessible.