```ruby
class QuestionsController  < ApplicationController

  def index
    @questions = Question.all
  end

  def new
    @question = Question.new
  end

  def create
    @question = Question.new(question_params)

    if @question.save
      redirect_to questions_path
    else
      render :new
    end
  end

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

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

    if @question.update_attributes(question_params)
      redirect_to questions_path
    else
      render :show
    end
  end

  private

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

end
```

Edit update method to fix typo.
user
```ruby
class QuestionsController  < ApplicationController

  def index
    @questions = Question.all
  end

  def new
    @question = Question.new
  end

  def create
    @question = Question.new(question_params)

    if @question.save
      redirect_to questions_path
    else
      render :new
    end
  end

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

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

    if @question.update(question_params)
      redirect_to questions_path
    else
      render :show
    end
  end

  private

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

end
```
assistant