Created
November 29, 2019 19:45
-
-
Save the-teacher/05a7f85237c756c4560017d31491597e to your computer and use it in GitHub Desktop.
roles-post-1
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
class PostsController < ApplicationController | |
def index | |
# ... | |
end | |
def show | |
# ... | |
end | |
def create | |
# ... | |
end | |
def update | |
@post = @current_user.posts.find(params[:id]) | |
@post.update!(post_params) | |
redirect_to @post | |
end | |
private | |
def post_params | |
params.require(:post).permit(:title, :content) | |
end | |
end |
Author
the-teacher
commented
Dec 1, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment