Class: HiveSQL::Comment

Inherits:
SqlBase
  • Object
show all
Defined in:
lib/hive_sql/models/comment.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SqlBase

#tx

Class Method Details

.find_by_author(author) ⇒ Object


69
70
71
# File 'lib/hive_sql/models/comment.rb', line 69

def self.find_by_author(author)
  where(author: author).first
end

77
78
79
# File 'lib/hive_sql/models/comment.rb', line 77

def self.find_by_author_and_permlink(author, permlink)
  where(author: author, permlink: permlink).first
end

.find_by_parent(parent_author) ⇒ Object


73
74
75
# File 'lib/hive_sql/models/comment.rb', line 73

def self.find_by_parent(parent_author)
  where(parent_author: parent_author).first
end

Instance Method Details

#beneficiariesObject


81
82
83
# File 'lib/hive_sql/models/comment.rb', line 81

def beneficiaries
  JSON[self[:beneficiaries]]
end

#tag_namesObject


85
86
87
# File 'lib/hive_sql/models/comment.rb', line 85

def tag_names
  tags.pluck(:tag)
end