summaryrefslogtreecommitdiff
path: root/app/finders/README.md
blob: 1a1c69dea38c8edcb98bc98f8f65b7b3f5f2397d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Finders

This type of classes responsible for collection items based on different conditions.
To prevent lookup methods in models like this:

```ruby
class Project
  def issues_for_user_filtered_by(user, filter)
    # A lot of logic not related to project model itself
  end
end

issues = project.issues_for_user_filtered_by(user, params)
```

Better use this:

```ruby
issues = IssuesFinder.new(project, user, filter).execute
```

It will help keep models thiner.