añadir track_activity para mostrar futuras notificaciones a los usuarios

This commit is contained in:
Julian Herrero
2015-10-06 12:05:34 +02:00
committed by rgarcia
parent 5e9240e25c
commit ba0ce4e14b
6 changed files with 20 additions and 3 deletions

View File

@@ -108,4 +108,12 @@ class ApplicationController < ActionController::Base
store_location_for(:user, request.path)
end
end
def track_activity(trackable)
if trackable.is_a? Comment
action = trackable.root? ? "debate_comment" : "comment_reply"
activity = current_user.activities.create! action: action, trackable: trackable
add_notifications_for activity
end
end
end