title: undefined method `update_attributes' for nil:NilClass when updating object
body: <p>I'm receiving the error "undefined method `update_attributes' for nil:NilClass" when I try to update my page object. I confirmed in pry that @page is empty, but I can't figure out why?</p>
  
  <pre><code>def new
      @page = Page.new
      @subjects = Subject.order('position ASC')
      @page_count = Page.count + 1
    end
  
    def create
      @page = Page.new(page_params)
      if @page.save
        flash[:notice] = 'New page added!'
        redirect_to action: 'index'
      else
        @subjects = Subject.order('position ASC')
        @page_count = Page.count + 1
        render 'new'
      end
    end
  
    def edit
      @page = Page.find_by(id: params[:id])
      @subjects = Subject.order('position ASC')
      @page_count = Page.count
    end
  
    def update
      @page = Page.find_by(id: params[:id])
      if @page.update_attributes(page_params)
        flash[:notice] = 'Page has been updated!'
        redirect_to action: 'show', id: @page.id
      else
        @subjects = Subject.order('position ASC')
        @page_count = Page.count
        render 'edit'
      end
    end
       private
  
    def page_params
      params.require(:page).permit(:subject_id, :name, :permalink, :position, :visible)
    end
  
  Routes:
  match ':controller(/:action(/:id))', :via =&gt; [:get, :post]
  </code></pre>