diff options
| author | hukl <hukl@berlin.ccc.de> | 2009-01-29 22:30:00 +0100 |
|---|---|---|
| committer | hukl <hukl@berlin.ccc.de> | 2009-01-29 22:30:00 +0100 |
| commit | 7edc07cb016bebb9b6c06e105f88f595d5ad00c3 (patch) | |
| tree | 4bb6e9ef4eb3d7f5ddb877d20bd2286e440f07c4 /lib | |
| parent | be47a4bbeac59d85af16b5e83e10ff242628519d (diff) | |
added generation of unique names based on the position on the tree after adding a node as a children of another node
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/awesome_patch.rb | 17 |
1 files changed, 17 insertions, 0 deletions
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 @@ | |||
| 1 | module CollectiveIdea | ||
| 2 | module Acts #:nodoc: | ||
| 3 | module NestedSet | ||
| 4 | module InstanceMethods | ||
| 5 | alias_method :move_to_original, :move_to | ||
| 6 | |||
| 7 | def move_to target, position | ||
| 8 | move_to_original target, position | ||
| 9 | if self.class == Node | ||
| 10 | self.update_unique_name | ||
| 11 | self.save | ||
| 12 | end | ||
| 13 | end | ||
| 14 | end | ||
| 15 | end | ||
| 16 | end | ||
| 17 | end \ No newline at end of file | ||
