Created
February 13, 2017 01:46
-
-
Save AndrewRayCode/a3af844913b7e786180510e062a599af to your computer and use it in GitHub Desktop.
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
# PATCH/PUT /microposts/1 | |
# PATCH/PUT /microposts/1.json | |
def update | |
respond_to do |format| | |
if @micropost.update(micropost_params) | |
format.html { redirect_to @micropost, notice: 'Micropost was successfully updated.' } | |
format.json { render :show, status: :ok, location: @micropost } | |
else | |
format.html { render :edit } | |
format.json { render json: @micropost.errors, status: :unprocessable_entity } | |
end | |
end | |
end |
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
test "should update micropost" do | |
patch micropost_url(@micropost), params: { micropost: { content: @micropost.content, user_id: @micropost.user_id } } | |
assert_redirected_to micropost_url(@micropost) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment