Created
May 10, 2011 20:14
-
-
Save courtsimas/965282 to your computer and use it in GitHub Desktop.
questions_controller update action
This file contains hidden or 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
def update | |
@question = current_user.questions.find(params[:id]) | |
message = "Your question needs to be between 10 and 255 characters" | |
if @question.update_attributes(params[:question]) | |
flash[:notice] = message = "Got it! Thanks for updating your question." | |
status = 200 | |
end | |
respond_to do |format| | |
format.html { redirect_to @question } | |
format.json { render :json => { :message => message, :status => status, :body => @question.body } ; flash.discard } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment