Created
January 23, 2023 16:43
-
-
Save descovi/6951dead5d6c4bc3bc719277a7a01b13 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
class ArticlesController < ApplicationController | |
def create | |
@article = Article.create article_params | |
if @article.save | |
redirect_to article_path(@article) | |
else | |
render :new | |
end | |
end | |
def delete | |
@article = Article.find params[:id] | |
@article.delete | |
redirect_to articles_path | |
end | |
def article_params | |
params.require(:article).permit(:title, :content) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment