From 7edc07cb016bebb9b6c06e105f88f595d5ad00c3 Mon Sep 17 00:00:00 2001 From: hukl Date: Thu, 29 Jan 2009 22:30:00 +0100 Subject: added generation of unique names based on the position on the tree after adding a node as a children of another node --- lib/awesome_patch.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 lib/awesome_patch.rb (limited to 'lib/awesome_patch.rb') diff --git a/lib/awesome_patch.rb b/lib/awesome_patch.rb new file mode 100644 index 0000000..1694ccf --- /dev/null +++ b/lib/awesome_patch.rb @@ -0,0 +1,17 @@ +module CollectiveIdea + module Acts #:nodoc: + module NestedSet + module InstanceMethods + alias_method :move_to_original, :move_to + + def move_to target, position + move_to_original target, position + if self.class == Node + self.update_unique_name + self.save + end + end + end + end + end +end \ No newline at end of file -- cgit v1.3