From 123dfcdd46aec2d5a58c4b352b485d72d5221e3c Mon Sep 17 00:00:00 2001
From: Matheus Agio Nerone <man13@inf.ufpr.br>
Date: Tue, 10 Nov 2015 15:31:52 -0200
Subject: [PATCH] fix bug when user not signed in

Signed-off-by: Matheus Agio Nerone <man13@inf.ufpr.br>
---
 app/controllers/learning_objects_controller.rb | 2 +-
 app/views/learning_objects/show.html.erb       | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/controllers/learning_objects_controller.rb b/app/controllers/learning_objects_controller.rb
index b2e41624..5078a276 100644
--- a/app/controllers/learning_objects_controller.rb
+++ b/app/controllers/learning_objects_controller.rb
@@ -13,7 +13,7 @@ class LearningObjectsController < ApplicationController
   # GET /learning_objects/1
   # GET /learning_objects/1.json
   def show
-    @liked = learning_object_repository.liked?(current_user, @learning_object)
+    @liked = learning_object_repository.liked?(current_user, @learning_object) if user_signed_in? 
   end
 
   # GET /learning_objects/new
diff --git a/app/views/learning_objects/show.html.erb b/app/views/learning_objects/show.html.erb
index a96154a4..ebee326b 100644
--- a/app/views/learning_objects/show.html.erb
+++ b/app/views/learning_objects/show.html.erb
@@ -61,6 +61,7 @@
         </div>
       </div>
       <div class="rating-panel">
+        <% if user_signed_in? %>
         <div class="actions">
           <div class="col-md-3 action">
             <%= link_to like_learning_object_path(id: @learning_object.id), class: 'vote',method: :post, remote: true do %>
-- 
GitLab