Skip to content

Instantly share code, notes, and snippets.

Created August 20, 2010 18:10
Show Gist options
  • Save anonymous/540836 to your computer and use it in GitHub Desktop.
Save anonymous/540836 to your computer and use it in GitHub Desktop.
#Routes
map.resources :posts
map.resources :posts, :member => {:unpublish => :post}
#Posts controller
def unpublish
@post = Post.find(params[:id])
@post.current_state = "unpublished"
@post.save
respond_to do |format|
format.html { redirect_to(@post, :notice => 'Post was successfully unpublished.') }
format.xml { render :xml => @post }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment