Sha256: 9888a5cea24ab7416cb618c3ecf716dcf6c2652d1355d58d957f98e5888999bf

Contents?: true

Size: 449 Bytes

Versions: 4

Compression:

Stored size: 449 Bytes

Contents

class ActsAsJoinable::Relationship < ActiveRecord::Base
  acts_as_relationship
  
  def swap_parent_and_child
    old_parent_type   = self.parent_type
    old_parent_id     = self.parent_id
    old_child_type    = self.child_type
    old_child_id      = self.child_id

    self.parent_type  = old_child_type
    self.parent_id    = old_child_id
    self.child_type   = old_parent_type
    self.child_id     = old_parent_id

    self.save!
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
acts-as-joinable-0.1.7.8 app/models/relationship.rb
acts-as-joinable-0.1.7.7 app/models/relationship.rb
acts-as-joinable-0.1.7.6 app/models/relationship.rb
acts-as-joinable-0.1.7.5 app/models/relationship.rb