diff options
Diffstat (limited to 'guides/code/getting_started/app/controllers')
5 files changed, 0 insertions, 85 deletions
diff --git a/guides/code/getting_started/app/controllers/application_controller.rb b/guides/code/getting_started/app/controllers/application_controller.rb deleted file mode 100644 index d83690e1b9..0000000000 --- a/guides/code/getting_started/app/controllers/application_controller.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ApplicationController < ActionController::Base - # Prevent CSRF attacks by raising an exception. - # For APIs, you may want to use :null_session instead. - protect_from_forgery with: :exception -end diff --git a/guides/code/getting_started/app/controllers/articles_controller.rb b/guides/code/getting_started/app/controllers/articles_controller.rb deleted file mode 100644 index 275b84e8b7..0000000000 --- a/guides/code/getting_started/app/controllers/articles_controller.rb +++ /dev/null @@ -1,53 +0,0 @@ -class ArticlesController < ApplicationController - - http_basic_authenticate_with name: "dhh", password: "secret", except: [:index, :show] - - def index - @articles = Article.all - end - - def show - @article = Article.find(params[:id]) - end - - def edit - @article = Article.find(params[:id]) - end - - def update - @article = Article.find(params[:id]) - - if @article.update(article_params) - redirect_to action: :show, id: @article.id - else - render 'edit' - end - end - - def new - @article = Article.new - end - - def create - @article = Article.new(article_params) - - if @article.save - redirect_to action: :show, id: @article.id - else - render 'new' - end - end - - def destroy - @article = Article.find(params[:id]) - @article.destroy - - redirect_to action: :index - end - - private - - def article_params - params.require(:article).permit(:title, :text) - end -end diff --git a/guides/code/getting_started/app/controllers/comments_controller.rb b/guides/code/getting_started/app/controllers/comments_controller.rb deleted file mode 100644 index 61813b1003..0000000000 --- a/guides/code/getting_started/app/controllers/comments_controller.rb +++ /dev/null @@ -1,23 +0,0 @@ -class CommentsController < ApplicationController - - http_basic_authenticate_with name: "dhh", password: "secret", only: :destroy - - def create - @article = Article.find(params[:article_id]) - @comment = @article.comments.create(comment_params) - redirect_to article_path(@article) - end - - def destroy - @article = Article.find(params[:article_id]) - @comment = @article.comments.find(params[:id]) - @comment.destroy - redirect_to article_path(@article) - end - - private - - def comment_params - params.require(:comment).permit(:commenter, :body) - end -end diff --git a/guides/code/getting_started/app/controllers/concerns/.keep b/guides/code/getting_started/app/controllers/concerns/.keep deleted file mode 100644 index e69de29bb2..0000000000 --- a/guides/code/getting_started/app/controllers/concerns/.keep +++ /dev/null diff --git a/guides/code/getting_started/app/controllers/welcome_controller.rb b/guides/code/getting_started/app/controllers/welcome_controller.rb deleted file mode 100644 index f9b859b9c9..0000000000 --- a/guides/code/getting_started/app/controllers/welcome_controller.rb +++ /dev/null @@ -1,4 +0,0 @@ -class WelcomeController < ApplicationController - def index - end -end |