Commit c54c936c0a854b12fc7344fe4f5c487200dd469f
1 parent
7c46be18
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
sub_organizations: fix relation
Showing
1 changed file
with
5 additions
and
7 deletions
Show diff stats
plugins/sub_organizations/lib/sub_organizations_plugin/relation.rb
| ... | ... | @@ -25,14 +25,12 @@ class SubOrganizationsPlugin::Relation < Noosfero::Plugin::ActiveRecord |
| 25 | 25 | end |
| 26 | 26 | end |
| 27 | 27 | |
| 28 | - class << self | |
| 29 | - def add_children(parent, *children) | |
| 30 | - children.each {|child| create!(:parent => parent, :child => child)} | |
| 31 | - end | |
| 28 | + def self.add_children(parent, *children) | |
| 29 | + children.each {|child| SubOrganizationsPlugin::Relation.create!(:parent => parent, :child => child)} | |
| 30 | + end | |
| 32 | 31 | |
| 33 | - def remove_children(parent, *children) | |
| 34 | - children.flatten.each {|child| find_by_parent_id_and_child_id(parent.id, child.id).destroy} | |
| 35 | - end | |
| 32 | + def self.remove_children(parent, *children) | |
| 33 | + children.flatten.each {|child| find_by_parent_id_and_child_id(parent.id, child.id).destroy} | |
| 36 | 34 | end |
| 37 | 35 | |
| 38 | 36 | end | ... | ... |