I wrote the code for you Twitter!
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