Created
March 8, 2011 02:58
-
-
Save buethling/859774 to your computer and use it in GitHub Desktop.
microposts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MicropostsController < ApplicationController | |
before_filter :authenticate, :only => [:create, :destroy] | |
before_filter :authorized_user, :only => :destroy | |
. | |
. | |
. | |
def destroy | |
@micropost.destroy | |
redirect_back_or root_path | |
end | |
private | |
def authorized_user | |
@micropost = Micropost.find(params[:id]) | |
redirect_to root_path unless current_user?(@micropost.user) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment