Skip to content

Instantly share code, notes, and snippets.

@vicramon
Last active September 2, 2020 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vicramon/6162c558e9e5f2b9c763504402937ed1 to your computer and use it in GitHub Desktop.
Save vicramon/6162c558e9e5f2b9c763504402937ed1 to your computer and use it in GitHub Desktop.
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