Commit 19f74903 authored by Marc Schwede's avatar Marc Schwede
parent a986241e
...@@ -51,7 +51,7 @@ class TodosFinder ...@@ -51,7 +51,7 @@ class TodosFinder
# #
# target - The value of the `target_type` column, such as `Issue`. # target - The value of the `target_type` column, such as `Issue`.
# state - The value of the `state` column, such as `pending` or `done`. # state - The value of the `state` column, such as `pending` or `done`.
def any_for_target?(target, *state) def any_for_target?(target, state = nil)
current_user.todos.any_for_target?(target, state) current_user.todos.any_for_target?(target, state)
end end
......
...@@ -93,8 +93,8 @@ class Todo < ApplicationRecord ...@@ -93,8 +93,8 @@ class Todo < ApplicationRecord
# #
# target - The value of the `target_type` column, such as `Issue`. # target - The value of the `target_type` column, such as `Issue`.
# state - The value of the `state` column, such as `pending` or `done`. # state - The value of the `state` column, such as `pending` or `done`.
def any_for_target?(target, *state) def any_for_target?(target, state = nil)
state.empty? ? exists?(target: target) : exists?(target: target, state: state) state.nil? ? exists?(target: target) : exists?(target: target, state: state)
end end
# Updates the state of a relation of todos to the new state. # Updates the state of a relation of todos to the new state.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment