Class: LikesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- LikesController
- Defined in:
- app/controllers/likes_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /activities/1/like.js.
- #destroy ⇒ Object
Instance Method Details
#create ⇒ Object
POST /activities/1/like.js
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/likes_controller.rb', line 6 def create @like = activity!.children.new :verb => "like" respond_to do |format| if @like.save tie!.activities << @like format.js else format.js end end end |
#destroy ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/likes_controller.rb', line 19 def destroy if (@like = activity!.liked_by(current_user).first) @like.destroy end respond_to do |format| format.js end end |