Class: WinewooCore::Services::Finders::Comments::WinewooUserCommentsFinder

Inherits:
CommentsFinder
  • Object
show all
Defined in:
lib/winewoo_core/services/finders/comments/winewoo_user_comments_finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(winewoo_user_id, filters) ⇒ WinewooUserCommentsFinder

Returns a new instance of WinewooUserCommentsFinder.



4
5
6
7
# File 'lib/winewoo_core/services/finders/comments/winewoo_user_comments_finder.rb', line 4

def initialize(winewoo_user_id, filters)
  super(filters)
  @winewoo_user_id = winewoo_user_id
end

Instance Method Details

#findObject



10
11
12
13
14
15
16
17
# File 'lib/winewoo_core/services/finders/comments/winewoo_user_comments_finder.rb', line 10

def find
  return unless @winewoo_user_id
  winewoo_user = User.find(@winewoo_user_id)
  return unless winewoo_user
  return winewoo_user.user_comments
    .page(@page || 1)
    .per(@per_page || Kaminari::config.default_per_page)
end