Topic: Routing issue on shared server with rails 3.0.0

Hello,

I hope that someone can help because I really have no more idea what my problem could be...

In development machine everything works fine (ruby 1.8.7, rails 3.0.0). After deploy with capistrano and git I cannot access most of the pages. If I got to the homepage (root :to => "courses#index"), I get the rails greeting screen and do not see any output in the logfile. I can access controller/new pages, but no index pages. Instead I get a "Something went wrong" page with errors in the logfile, for example:

Started GET "/attendees/" for 77.8.186.17 at Sun Feb 13 09:25:07 +0100 2011
  Processing by AttendeesController#index as HTML
Completed   in 2ms

ArgumentError (NULL pointer given):
  app/controllers/attendees_controller.rb:5:in `index'


or when after creating a new record the controller links to the show action, I get:

Started GET "/attendees/1" for 77.8.186.17 at Sun Feb 13 09:27:21 +0100 2011
  Processing by AttendeesController#show as HTML
  Parameters: {"id"=>"1"}
Completed   in 3ms

ArgumentError (NULL pointer given):
  app/controllers/attendees_controller.rb:16:in `show'

Controller almost without any changes after scaffolding:

class AttendeesController < ApplicationController
  # GET /attendees
  # GET /attendees.xml
  def index
    @attendees = Attendee.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @attendees }
    end
  end

  # GET /attendees/1
  # GET /attendees/1.xml
  def show
    @attendee = Attendee.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @attendee }
    end
  end

  # GET /attendees/new
  # GET /attendees/new.xml
  def new
    @attendee = Attendee.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @attendee }
    end
  end

  # GET /attendees/1/edit
  def edit
    @attendee = Attendee.find(params[:id])
  end

  # POST /attendees
  # POST /attendees.xml
  def create
    @attendee = Attendee.new(params[:attendee])

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

  # PUT /attendees/1
  # PUT /attendees/1.xml
  def update
    @attendee = Attendee.find(params[:id])

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

  # DELETE /attendees/1
  # DELETE /attendees/1.xml
  def destroy
    @attendee = Attendee.find(params[:id])
    @attendee.destroy

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


my routes.rb:

EasyCourseadmin::Application.routes.draw do
  resources :lessons
  post "lessons/new"
  resources :attendees
  get "admin/index"
  controller :sessions do
    get 'login' => :new
    post 'login' => :create
    delete 'logout' => :destroy
  end
  get "sessions/create"
  get "sessions/destroy"
  resources :users
  resources :courses
  root :to => "courses#index"
end

On my server at domainfactory, I created a subdomain with rails enabled. My subdomain is: /path_to_subdomain/current/public and the path to the rails-app is "/".

git repository is on the same server.

Does anyone have an idea, what could be wrong there?


Thank you so much for any ideas!!!!
rockie

Last edited by rockie (2011-02-13 04:39:13)