diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-02-25 21:15:08 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-02-25 21:15:08 +0400 |
commit | 645e8d470559b07a22164c55b76195a60fb8b37b (patch) | |
tree | d77b7a795c0bf503586e1e704064432e2df96c0b /app/finders/README.md | |
parent | 0f473674920dfc6759ddf131b32eb0b4b06256d0 (diff) |
Move services for collecting items to Finders
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/finders/README.md')
-rw-r--r-- | app/finders/README.md | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/finders/README.md b/app/finders/README.md new file mode 100644 index 00000000000..6fbf0e2f4c1 --- /dev/null +++ b/app/finders/README.md @@ -0,0 +1,24 @@ +# Finders + +This type of classes responsible for collectiong items based on different conditions. +To prevent lookup methods in models like this: + +``` +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: + +``` +selector = Finders::Issues.new + +issues = selector.execute(project, user, filter) +``` + +It will help keep models thiner |