Class: Socializer::LikesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Socializer::LikesController
- Defined in:
- app/controllers/socializer/likes_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
-
#index ⇒ Object
REFACTOR: should handle activity/tooltip as well as people likes Used to display the Like tooltip.
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'app/controllers/socializer/likes_controller.rb', line 20 def create @likable.like!(current_user) unless current_user.likes?(@likable) @activity = @likable.activitable respond_to do |format| format.js end end |
#destroy ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'app/controllers/socializer/likes_controller.rb', line 29 def destroy @likable.unlike!(current_user) if current_user.likes?(@likable) @activity = @likable.activitable respond_to do |format| format.js end end |
#index ⇒ Object
REFACTOR: should handle activity/tooltip as well as people likes Used to display the Like tooltip
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/socializer/likes_controller.rb', line 7 def index activity = Activity.find(params[:id]) @object_ids = [] activity.activity_object.likes.each do |person| @object_ids.push person.activity_object end respond_to do |format| format.html { render layout: false if request.xhr? } end end |