From 2661ca4c7687a9ec733fcd0c5ce0ee37c5b0a027 Mon Sep 17 00:00:00 2001
From: Bruno Nocera Zanette <bnzanette@inf.ufpr.br>
Date: Mon, 28 Sep 2015 23:08:59 -0300
Subject: [PATCH] Refactor to use RepositoriesProxy module

---
 lib/tasks/thumbnail.rake | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/lib/tasks/thumbnail.rake b/lib/tasks/thumbnail.rake
index 3de4c7447..5ae12d9c2 100644
--- a/lib/tasks/thumbnail.rake
+++ b/lib/tasks/thumbnail.rake
@@ -3,6 +3,8 @@ namespace :thumbnail do
   desc "Generate Thumbnails"
   task :generate => :environment do
 
+    include RepositoriesProxy
+
     # Quantity of items fetched on each iteration
     limit = 1000
 
@@ -13,7 +15,7 @@ namespace :thumbnail do
 
       begin
         # Get items from dspace (from offset to offset+limit)
-        items = item_database_repository.all(limit,offset)
+        items = learning_object_repository.all(limit,offset)
       rescue
         # Sleeps for a while to wait database's recovery
         sleep(30.seconds)
@@ -34,10 +36,4 @@ namespace :thumbnail do
     end
   end
 
-  private
-
-  def item_database_repository
-    @item_database_repository ||= Portalmec::Application.repository.for(:learning_object)
-  end
-
 end
-- 
GitLab