diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-09-21 16:06:58 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-09-21 16:34:18 +0300 |
commit | 9176ea999a96580358be9bbcd42403879c5ae707 (patch) | |
tree | 33f9b50e0f85fbe11b79df8cf56ddfe8f8861ead /app/finders/group_labels_finder.rb | |
parent | e18d8d590b45daca41a1be39289fe29859504c09 (diff) |
Move group labels AR code into finder
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/finders/group_labels_finder.rb')
-rw-r--r-- | app/finders/group_labels_finder.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/finders/group_labels_finder.rb b/app/finders/group_labels_finder.rb new file mode 100644 index 00000000000..903023033ed --- /dev/null +++ b/app/finders/group_labels_finder.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class GroupLabelsFinder + attr_reader :group, :params + + def initialize(group, params = {}) + @group = group + @params = params + end + + def execute + group.labels + .optionally_search(params[:search]) + .order_by(params[:sort]) + .page(params[:page]) + end +end |