Skip to content

Setup the Controller

cesidio edited this page Nov 8, 2012 · 1 revision

Simple actions for like and unlike

  def like
    story = Story.find(params[:id])
    respond_to do | format |
      format.json { render json: { success: story.like(current_user).present? }.to_json }
    end
  end

  def unlike
    story = Story.find(params[:id])
    respond_to do | format |
      format.json { render json: { success: story.unlike(current_user).present? }.to_json }
    end
  end
Clone this wiki locally