Last active
September 2, 2020 19:52
-
-
Save vicramon/6162c558e9e5f2b9c763504402937ed1 to your computer and use it in GitHub Desktop.
I wrote the code for you Twitter!
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
class TweetsController < ApplicationController | |
def update | |
tweet = Tweet.find(tweet_params[:id]) | |
if tweet.editable_by?(current_user) | |
tweet.update!(body: tweet_params[:body]) | |
end | |
end | |
private | |
def tweet_params | |
params.require(:tweet).permit(:id, :body) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment