BigW Consortium Gitlab

README.md 467 Bytes
Newer Older
1 2
# Finders

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

6
```ruby
7 8 9 10 11 12 13 14 15
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)
```

16
Better use this:
17

18
```ruby
19
issues = IssuesFinder.new(project, user, filter).execute
20 21
```

22
It will help keep models thiner.