Sha256: 75be7fae452ff1f8d2c98c8d585cc2c0de560f19c2ddf36ca7c5bc1cd59b1d6a

Contents?: true

Size: 564 Bytes

Versions: 3

Compression:

Stored size: 564 Bytes

Contents

class Relation < ActiveRecord::Base
  def self.add_raw(name, from_id, to_id)
    hsh = { name: name, from_id: from_id, to_id: to_id }
    Relation.create!(hsh) if Relation.where(hsh).first.nil?
  end

  def self.delete_raw(name, from_id, to_id)
    hsh = { name: name, from_id: from_id, to_id: to_id }
    Relation.where(hsh).delete_all
  end

  def self.references_raw(name, from_id)
    Relation.where(name: name, from_id: from_id).pluck(:to_id)
  end

  def self.followers_raw(name, to_id)
    Relation.where(name: name, to_id: to_id).pluck(:from_id)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
relation-0.3.8 app/models/relation.rb
relation-0.3.7 app/models/relation.rb
relation-0.3.5 app/models/relation.rb