Skip to content

Instantly share code, notes, and snippets.

@bradylove
Created March 26, 2011 06:51
Show Gist options
  • Save bradylove/888083 to your computer and use it in GitHub Desktop.
Save bradylove/888083 to your computer and use it in GitHub Desktop.
def update
@post = Post.find(params[:id])
@post.published_at = @post.update_published(params[:published], @post.published_at)
if @post.update_attributes(params[:post])
redirect_to @post, :notice => "Post has been updated."
else
flash[:alert] = "Post has not been updated."
render :action => "edit"
end
end
def destroy
@post = Post.find(params[:id])
@post.destroy
redirect_to root_path, :notice => "Post has been deleted."
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment