Module: Likepost

Defined in:
lib/likepost.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



12
13
14
15
16
17
18
19
# File 'lib/likepost.rb', line 12

def destroy
    if ! (already_liked?)
        flash[:notice] = "You cannot unlike"
    else
        @like.destroy
    end
    redirect_to post_path(@post)
end

#likeObject



2
3
4
5
6
7
8
9
10
11
# File 'lib/likepost.rb', line 2

def like
	
respond_to do |format|
format.html do
flash[:success] = "Like Counted!"
redirect_to post_path(@post)
 end
  format.js
     end
end