Rails on hosting server upgraded to 2.3.5 and my app broke

Please note that the “1” in the URL is not action id or session id but
the category or page id stored in database.

The error log says:

Processing ApplicationController#index (for xxx.xxx.xxx.xxx at
2010-12-19 09:32:18) [GET]

ActionController::RoutingError (No route matches "//pages/1/display"
with {:method=>:get}):

Rendering /home/hof/etc/rails_apps/ha/public/404.html (404 Not Found)

hmmm. I’ve never seen such error before, a bit lost.

Here is my route.rb:

ActionController::Routing::Routes.draw do |map|
  map.resources :users

  map.resources :notifications

  map.resources :pages, :member => {:display => :get,
                                    :display_free_style => :get}

  map.resources :events, :collection => {:display => :get}

  map.resources :subcategories

  map.resources :categories  #, :has_many => :subcategories

  map.root :controller => "hof"


  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
end

rake routes shows the following result:


 users GET    /users(.:format)                        {:action=>"index",
:controller=>"users"}
                        POST   /users(.:format)
{:action=>"create", :controller=>"users"}
               new_user GET    /users/new(.:format)
{:action=>"new", :controller=>"users"}
              edit_user GET    /users/:id/edit(.:format)
{:action=>"edit", :controller=>"users"}
                   user GET    /users/:id(.:format)
{:action=>"show", :controller=>"users"}
                        PUT    /users/:id(.:format)
{:action=>"update", :controller=>"users"}
                        DELETE /users/:id(.:format)
{:action=>"destroy", :controller=>"users"}
          notifications GET    /notifications(.:format)
{:action=>"index", :controller=>"notifications"}
                        POST   /notifications(.:format)
{:action=>"create", :controller=>"notifications"}
       new_notification GET    /notifications/new(.:format)
{:action=>"new", :controller=>"notifications"}
      edit_notification GET    /notifications/:id/edit(.:format)
{:action=>"edit", :controller=>"notifications"}
           notification GET    /notifications/:id(.:format)
{:action=>"show", :controller=>"notifications"}
                        PUT    /notifications/:id(.:format)
{:action=>"update", :controller=>"notifications"}
                        DELETE /notifications/:id(.:format)
{:action=>"destroy", :controller=>"notifications"}
                  pages GET    /pages(.:format)
{:action=>"index", :controller=>"pages"}
                        POST   /pages(.:format)
{:action=>"create", :controller=>"pages"}
               new_page GET    /pages/new(.:format)
{:action=>"new", :controller=>"pages"}
              edit_page GET    /pages/:id/edit(.:format)
{:action=>"edit", :controller=>"pages"}
display_free_style_page GET    /pages/:id/display_free_style(.:format)
{:action=>"display_free_style", :controller=>"pages"}
           display_page GET    /pages/:id/display(.:format)
{:action=>"display", :controller=>"pages"}
                   page GET    /pages/:id(.:format)
{:action=>"show", :controller=>"pages"}
                        PUT    /pages/:id(.:format)
{:action=>"update", :controller=>"pages"}
                        DELETE /pages/:id(.:format)
{:action=>"destroy", :controller=>"pages"}
         display_events GET    /events/display(.:format)
{:action=>"display", :controller=>"events"}
                 events GET    /events(.:format)
{:action=>"index", :controller=>"events"}
                        POST   /events(.:format)
{:action=>"create", :controller=>"events"}
              new_event GET    /events/new(.:format)
{:action=>"new", :controller=>"events"}
             edit_event GET    /events/:id/edit(.:format)
{:action=>"edit", :controller=>"events"}
                  event GET    /events/:id(.:format)
{:action=>"show", :controller=>"events"}
                        PUT    /events/:id(.:format)
{:action=>"update", :controller=>"events"}
                        DELETE /events/:id(.:format)
{:action=>"destroy", :controller=>"events"}
          subcategories GET    /subcategories(.:format)
{:action=>"index", :controller=>"subcategories"}
                        POST   /subcategories(.:format)
{:action=>"create", :controller=>"subcategories"}
        new_subcategory GET    /subcategories/new(.:format)
{:action=>"new", :controller=>"subcategories"}
       edit_subcategory GET    /subcategories/:id/edit(.:format)
{:action=>"edit", :controller=>"subcategories"}
            subcategory GET    /subcategories/:id(.:format)
{:action=>"show", :controller=>"subcategories"}
                        PUT    /subcategories/:id(.:format)
{:action=>"update", :controller=>"subcategories"}
                        DELETE /subcategories/:id(.:format)
{:action=>"destroy", :controller=>"subcategories"}
             categories GET    /categories(.:format)
{:action=>"index", :controller=>"categories"}
                        POST   /categories(.:format)
{:action=>"create", :controller=>"categories"}
           new_category GET    /categories/new(.:format)
{:action=>"new", :controller=>"categories"}
          edit_category GET    /categories/:id/edit(.:format)
{:action=>"edit", :controller=>"categories"}
               category GET    /categories/:id(.:format)
{:action=>"show", :controller=>"categories"}
                        PUT    /categories/:id(.:format)
{:action=>"update", :controller=>"categories"}
                        DELETE /categories/:id(.:format)
{:action=>"destroy", :controller=>"categories"}
                   root        /
{:action=>"index", :controller=>"hof"}
                               /:controller/:id/:action

here is the pages_controller.rb:

class PagesController < ApplicationController
  caches_page :display

  @@free_layout_pages = ["Demo Film",
                         "Drive Instruction", "Legal & Credits",
                         "Business Time"]

  def index
    @pages = Page.find(:all, :order => "category_id")

    respond_to do |format|
      format.html
      format.xml  { render :xml => @pages }
    end
  end


  def show
    @page = Page.find(params[:id])

    respond_to do |format|
      format.html
      format.xml  { render :xml => @page }
    end
  end

  def display
    @page = Page.find(params[:id])

    if (@@free_layout_pages.include?(@page.subcategory.name_en))
      redirect_to :action => "display_free_style"
    else
      respond_to do |format|
        format.html
        format.xml  { render :xml => @page }
      end
    end

  end

  def display_free_style

    @page = Page.find(params[:id])

    respond_to do |format|
      format.html
      format.xml  { render :xml => @page }
    end
  end

  def new
    @page = Page.new

    respond_to do |format|
      format.html
      format.xml  { render :xml => @page }
    end
  end

  def edit
    @page = Page.find(params[:id])
  end


  def create
    @page = Page.new(params[:page])

    respond_to do |format|
      if @page.save
        flash[:notice] = 'Page was successfully created.'
        format.html { redirect_to(@page) }
        format.xml  { render :xml => @page, :status => :created,
:location => @page }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @page.errors, :status =>
:unprocessable_entity }
      end
    end
  end


  def update
    @page = Page.find(params[:id])

    respond_to do |format|
      if @page.update_attributes(params[:page])
        flash[:notice] = 'Page was successfully updated.'
        format.html { redirect_to(@page) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @page.errors, :status =>
:unprocessable_entity }
      end
    end
  end

  def destroy
    @page = Page.find(params[:id])
    @page.destroy

    respond_to do |format|
      format.html { redirect_to(pages_url) }
      format.xml  { head :ok }
    end
  end
end

I just quickly read through the release notes of rails 2.3. But did not
get any clue about what I should change to get my app running again. I
must have missed something but don’t know what.

Could anyone please give me a hint? Any help will be highly appreciated!

Best Regards,
Lydia

On 8 January 2011 17:55, Lydia L. [email protected] wrote:

Please note that the “1” in the URL is not action id or session id but
the category or page id stored in database.

The error log says:

[code]
Processing ApplicationController#index (for xxx.xxx.xxx.xxx at
2010-12-19 09:32:18) [GET]

There is a lot of useful information you could have given us. Did it
display the index page ok at this point?

ActionController::RoutingError (No route matches “//pages/1/display”
with {:method=>:get}):

What did you click to make it show this, if anything?

Colin

There is a lot of useful information you could have given us. Did it
display the index page ok at this point?

Colin, thank you very much for taking the trouble to reply. No it does
not even display the index page. I just found out that the index page
which appeared was a cached fake. Maybe the admin of my host provider
put it there, but I don’t know. When I renamed that index.html, I got an
immediate 404 and my app production log says:

ActionController::RoutingError (No route matches “//” with
{:method=>:get}):

Best Regards,
Lydia

On 8 January 2011 21:00, Lydia L. [email protected] wrote:

{:method=>:get}):
Does it work ok in development mode on your local PC and pass all your
automated tests?

Colin