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 } |
NewerOlder