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



101
102
103
# File 'lib/hive_sql/models/comment.rb', line 101

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


109
110
111
# File 'lib/hive_sql/models/comment.rb', line 109

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

.find_by_parent(parent_author) ⇒ Object



105
106
107
# File 'lib/hive_sql/models/comment.rb', line 105

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

Instance Method Details

#beneficiariesObject



113
114
115
# File 'lib/hive_sql/models/comment.rb', line 113

def beneficiaries
  JSON[self[:beneficiaries]]
end

#hydrated_json_metadataObject



121
122
123
# File 'lib/hive_sql/models/comment.rb', line 121

def 
  JSON[] rescue {}
end

#tag_namesObject



117
118
119
# File 'lib/hive_sql/models/comment.rb', line 117

def tag_names
  tags.pluck(:tag)
end