Correctly returns todo ID after creating todo

This commit is contained in:
Phil Hughes
2016-06-27 17:00:27 +01:00
parent 3659992cd5
commit d17ab054cf
+2 -1
View File
@@ -159,8 +159,9 @@ class TodoService
def create_todos(users, attributes)
Array(users).map do |user|
next if pending_todos(user, attributes).exists?
Todo.create(attributes.merge(user_id: user.id))
todo = Todo.create(attributes.merge(user_id: user.id))
user.update_todos_count_cache
todo
end
end