-
-
Save trotter/540864 to your computer and use it in GitHub Desktop.
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
#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
I think you may need map.resources :posts, :members => {:unpublish => :post}