Class: LikesController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#fresh_when, #redirect_back_or_default, #redirect_referrer_or_default, #render_403, #render_404, #render_optional_error_file, #require_user, #set_active_menu, #set_locale, #set_seo_meta, #store_location, #unread_notify_count

Instance Method Details

#createObject


5
6
7
8
# File 'app/controllers/likes_controller.rb', line 5

def create
  current_user.like(@item)
  render plain: @item.reload.likes_count
end

#destroyObject


10
11
12
13
# File 'app/controllers/likes_controller.rb', line 10

def destroy
  current_user.unlike(@item)
  render plain: @item.reload.likes_count
end