I have a problem when I try using debugger in rails with byebug...I installed the byebug gem without any problems ... in gemfile :
group :development, :test do
gem 'sqlite3'
gem 'byebug'
end
put the debugger in my controller:
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
(I am using gitbash in windwos 7 ) The problem is when I try calling article_params I get a blank line only for long time with no respond I tried to restart my server and and tried debugging again but same problem....Here is an image for the problem
here is the code from git bash (is the same in the image):
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)
Any one can help please?
So I found this question on Stackoverflow Byebug fully supports Windows or not? that was posted in Jan 2017.
I followed the issues on Github and found a commit in rails (sorry my network blocks github so can't like to them). the mri platform is not supported on windows and rails Gemfile
generator template has now been updated to.
gem 'byebug', platform: [:mri, :mingw, :x64_mingw]
I made the change then ran my code and byebug
now works on windows!
Might need to run bundle after the change.