class QuestionsController < ActionController::Base

  def index
    @question = Question.all
  end

  def show
    @question = Question.find(params[:id])
  end

  def new
    @question = Question.new
  end

  def create
    @question = Question.new(question_params)
    p params
    if @question.save
      redirect_to root_path
    end
  end

  def edit
    @question = Question.find(params[:id])
  end

  def update
    @question = Question.find(params[:id])
    @question.assign_attributes(question_params)
    if @question.save
      redirect_to root_path
    else
      render :edit
    end
  end

  def destroy
    @question = Question.find(params[:id])
    @question.destroy
    flash[:notice] = "Question has been deleted"
    redirect_to root_path
  end

  private

  def question_params
    params.require(:question).permit(:title, :body, :view_count, :user_id)
  end

end
class QuestionsController < ActionController::Base

  def index
    @question = Question.all
  end

  def show
    @question = Question.find(params[:id])
  end

  def new
    @question = Question.new
  end

  def create
    @question = Question.new(question_params)
    if @question.save
      redirect_to questions_path
    end
  end

  def edit
    @question = Question.find(params[:id])
  end

  def update
    @question = Question.find(params[:id])
    @question.assign_attributes(question_params)
    if @question.save
      redirect_to @question
    else
      render :edit
    end
  end

  def destroy
    @question = Question.find(params[:id])
    @question.destroy
    flash[:notice] = "Question has been deleted"
    redirect_to questions_path
  end

  private

  def question_params
    params.require(:question).permit(:title, :body, :view_count, :user_id)
  end

end
--- 
+++ 
@@ -14,8 +14,9 @@
 
   def create
     @question = Question.new(question_params)
+    p params
     if @question.save
-      redirect_to questions_path
+      redirect_to root_path
     end
   end
 
@@ -27,7 +28,7 @@
     @question = Question.find(params[:id])
     @question.assign_attributes(question_params)
     if @question.save
-      redirect_to @question
+      redirect_to root_path
     else
       render :edit
     end
@@ -37,7 +38,7 @@
     @question = Question.find(params[:id])
     @question.destroy
     flash[:notice] = "Question has been deleted"
-    redirect_to questions_path
+    redirect_to root_path
   end
 
   private
Change redirect to root path for update and create
