Class: LikesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/likes_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /activities/1/like.js



5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/likes_controller.rb', line 5

def create
  @like = Like.build(current_subject, current_user, @indirect_id)
  
  respond_to do |format|
    if @like.save
      format.js
    else
      format.js
    end
  end
end

#destroyObject

DELETE /activities/1/like.js



18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/likes_controller.rb', line 18

def destroy
  @like = Like.find!(current_subject, @indirect_id)
  
  respond_to do |format|
    if @like.destroy
      format.js
    else
      format.js
    end
  end
end