Class: Lentil::LikeVotesController

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

Instance Method Summary collapse

Instance Method Details

#tallyObject



3
4
5
6
7
8
9
10
11
# File 'app/controllers/lentil/like_votes_controller.rb', line 3

def tally
  image = Image.find(params[:image_id])
  like_vote = LikeVote.new(:image => image)
  if like_vote.save
    session[:liked_images] ||= []
    session[:liked_images] << params[:image_id]
  end
  redirect_to :back
end