byebugを使用してレールでデバッガーを使用しようとすると問題が発生します...問題なくbyebug gemをインストールしました... gemfileに:
group :development, :test do
gem 'sqlite3'
gem 'byebug'
end
コントローラーにデバッガーを配置します。
class ArticlesController < ApplicationController
before_action :set_article, only: [:edit, :update, :show, :destroy]
def new
@article = Article.new
end
def create
debugger
@article = Article.new(article_params)
# @article.user = User.first
if @article.save
flash[:success] = "Article was successfully created"
redirect_to article_path(@article)
else
render 'new'
end
end
def show
end
def index
@articles = Article.all
end
def edit
end
def update
if @article.update(article_params)
flash[:success] = "Article was successfully updated"
redirect_to article_path(@article)
else
render 'edit'
end
end
def destroy
@article.destroy
flash[:danger] = "Article was successfully deleted"
redirect_to articles_path
end
private
def set_article
@article = Article.find(params[:id])
end
def article_params
params.require(:article).permit(:title, :description)
end
end
(windwos 7 で gitbash を使用しています)問題は、article_params を呼び出そうとすると、長い間空白行が表示され、応答がありません。サーバーを再起動して、もう一度デバッグを試みましたが、同じ問題が発生しました。問題のイメージ
git bash のコードは次のとおりです (画像でも同じです)。
5: @article = Article.new
6: end
7:
8: def create
9: debugger
=> 10: @article = Article.new(article_params)
11: # @article.user = User.first
12: if @article.save
13: flash[:success] = "Article was successfully created"
14: redirect_to article_path(@article)
(byebug) article_params
-(here goes the blank line)
誰でも助けてくれますか?