line.rb - warvox - VoIP based wardialing tool, forked from rapid7/warvox.
 (HTM) git clone git://jay.scot/warvox
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
       line.rb (704B)
       ---
            1 # == Schema Information
            2 #
            3 # Table name: lines
            4 #
            5 #  id         :integer          not null, primary key
            6 #  created_at :datetime
            7 #  updated_at :datetime
            8 #  number     :text             not null
            9 #  project_id :integer          not null
           10 #  line_type  :text
           11 #  notes      :text
           12 #
           13 
           14 class Line < ApplicationRecord
           15   has_many :line_attributes, dependent: :delete_all
           16   belongs_to :project
           17 
           18   def set_attribute(name, value, ctype='text/plain')
           19     la = LineAttribute.where(line_id: self.id, project_id: self.project_id, name: name).first_or_create
           20     la.value = value
           21     la.ctype = ctype
           22     la.save
           23     la
           24   end
           25 
           26   def get_attribute(name)
           27     LineAttribute.where(line_id: self[:id], name: name).first
           28   end
           29 end