Sha256: 3971834335b278ea62f81aab4dd52f3b24a10d1e069f52012bac2c32c7302ef6

Contents?: true

Size: 553 Bytes

Versions: 3

Compression:

Stored size: 553 Bytes

Contents

class Relation < ActiveRecord::Base

  def self.add_raw(name, id_from, id_to)
    hsh = { name: name, x_id: id_from, y_id: id_to }
    Relation.create!(hsh)  if Relation.where(hsh).first == nil
  end

  def self.delete_raw(name, id_from, id_to)
    hsh = { name: name, x_id: id_from, y_id: id_to }
    Relation.where(hsh).delete_all
  end

  def self.references_raw(name, id_from)
    Relation.where(name: name, x_id: id_from).pluck(:y_id)
  end

  def self.followers_raw(name, id_to)
    Relation.where(name: name, y_id: id_to).pluck(:x_id)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
relation-0.2.3 app/models/relation.rb
relation-0.2.2 app/models/relation.rb
relation-0.2.1 app/models/relation.rb