Class: Workarea::Admin::CommentViewModel

Inherits:
ApplicationViewModel
  • Object
show all
Defined in:
app/view_models/workarea/admin/comment_view_model.rb

Instance Method Summary collapse

Instance Method Details

#authorObject



4
5
6
7
8
9
10
# File 'app/view_models/workarea/admin/comment_view_model.rb', line 4

def author
  return @author if defined?(@author)

  @author = if model = User.where(id: author_id).first
              UserViewModel.new(model)
            end
end

#author_nameObject



12
13
14
15
# File 'app/view_models/workarea/admin/comment_view_model.rb', line 12

def author_name
  return '' unless author.present?
  author.name
end