Code Cleanup: Usage of Polymorphic User instead of ExternalUser and InternalUser

Renamed requestor_user_id -> user_id
Index of request_for_comments now returns the n (5?) newest requests per user. Solved via sliding windows in postgres, code added to model.
Added route to /my_request_for_comments/ that shows all requests for the current user.
Changed view from ERB to slim
This commit is contained in:
Ralf Teusner
2015-09-03 19:04:38 +02:00
parent 8e9f19f41d
commit d292fec47c
15 changed files with 78 additions and 47 deletions

View File

@@ -2,12 +2,9 @@
<h4 class="list-group-item-heading"><%= Exercise.find(@request_for_comment.exercise_id) %></h4>
<p class="list-group-item-text">
<%
user = nil
if (@request_for_comment.user_type == 'InternalUser')
user = InternalUser.find(@request_for_comment.requestor_user_id)
else
user = ExternalUser.find(@request_for_comment.requestor_user_id)
end
user = @request_for_comment.user
%>
<%= user %> | <%= @request_for_comment.requested_at %>
</p>