Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2016-05-21 20:01:11 +0300
committerRobert Schilling <rschilling@student.tugraz.at>2016-07-01 11:49:34 +0300
commit39e6f504fcb8c6cab511a50cdefd76e821bfec17 (patch)
tree36a8b9c41333f5bd0e832f94ee2c2d63ea707766 /lib/api/todos.rb
parentb94088d5124b08349e5bd99c49a8ae3fcc5f5e6b (diff)
Move to helper, no instance variables
Diffstat (limited to 'lib/api/todos.rb')
-rw-r--r--lib/api/todos.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/api/todos.rb b/lib/api/todos.rb
index f45c0ae634a..db1f16cec59 100644
--- a/lib/api/todos.rb
+++ b/lib/api/todos.rb
@@ -14,11 +14,11 @@ module API
#
# Example Request:
# GET /todos
+ #
get do
- @todos = find_todos
- @todos = paginate @todos
+ todos = find_todos
- present @todos, with: Entities::Todo
+ present paginate(todos), with: Entities::Todo
end
# Mark todo as done
@@ -31,10 +31,10 @@ module API
# DELETE /todos/:id
#
delete ':id' do
- @todo = current_user.todos.find(params[:id])
- @todo.done
+ todo = current_user.todos.find(params[:id])
+ todo.done
- present @todo, with: Entities::Todo
+ present todo, with: Entities::Todo
end
# Mark all todos as done
@@ -44,10 +44,10 @@ module API
# DELETE /todos
#
delete do
- @todos = find_todos
- @todos.each(&:done)
+ todos = find_todos
+ todos.each(&:done)
- present @todos, with: Entities::Todo
+ present paginate(todos), with: Entities::Todo
end
end
end