Changeset 9

Show
Ignore:
Timestamp:
08/29/06 16:47:20 (2 years ago)
Author:
jcm
Message:

#8 no root creation when empty

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/better_nested_set.rb

    r8 r9  
    137137        # on creation, set automatically lft and rgt to the end of the tree 
    138138        def before_create 
    139           maxright = self.class.maximum(acts_as_nested_set_options[:right_column], :conditions => acts_as_nested_set_options[:scope]) 
     139          maxright = self.class.maximum(acts_as_nested_set_options[:right_column], :conditions => acts_as_nested_set_options[:scope]) || 0 
    140140          # adds the new node to the right of all existing nodes 
    141141          self[acts_as_nested_set_options[:left_column]] = maxright+1