[Betternestedset-talk] move_to_child_of in after_save Callback

Larry E. Lutz lutzle at swbell.net
Thu Apr 17 14:14:30 EDT 2008


I'm trying to include a move_to_child_of in an after_save callback, but no
matter how I do it, it seems to error out. Specifically, I've got a
attribute named bns_parent_id in my model (and associated field in the
table). I choose to create this field because I've been told that BNS does
like it when you try to mess with it's reserved fields (parent_id, lft, and
rgt). I have a field for bns_parent_id in my view (but not for parent_id).
The I have the following in my model:


  def after_save(record)  
    record.move_to_child_of record.bns_parent_id  
  end

I've tried multiple permutations of this callback, but they all seem to
error out. Does anyone have any idea how to make this work? (By the way, it
would be great if this or a similar type of functionality was incorporated
into BetterNestedSet.)

Larry E. Lutz 
lutzle at swbell.net 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 8270 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/betternestedset-talk/attachments/20080417/0651c2e5/attachment.bin 


More information about the Betternestedset-talk mailing list