Unknown action No action responded to show

Baba Bobo wrote:

sorry the correct/working URL for Profile page is
http://localhost:3000/user/profile/1

Baba Bobo wrote:

If I add the following code to my only controller file
"user_controller.rb"

def show
  @user = User.find(params[:user])

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

After which when i refresh the Registeration page at
"http://localhost:3000/user/register"
it gives me following message:

ActiveRecord::RecordNotFound in UserController#show
Couldn't find User without an ID

Controllers are customarily named in the plural...
UsersController, as opposed to UserController.

What does a "rake routes" report to you?

rake routes >routes.lst

Then peruse that file... You're mixing restful routes with
"non-restful" ones I think, and earlier routes are evaluated before
later in the routes.rb file, so your map.resources :user is probably
masking the later definition for "profile".

With restful routes, you can add custom routing with:

map.resources :users, :member => {:profile => :get}
(for a single user resource, there's a profile route and view, you
provide the controller method, and the view)

or

map.resource :users, :collection => {:my_index => :get}
(for a list of users, there's a my_index route and view, again you write
the controller method and view)

or combine them (both member and collection specs).

Oh, and I think your
   :id => User.find(params[:id])
is simply
   :id => params[:id]
no need for the find

Ar Chron wrote:

Controllers are customarily named in the plural...
UsersController, as opposed to UserController.

What does a "rake routes" report to you?

Thanks for the prompt reply. I agree i am messing up somewhere with the
restful routing. By the time i am playing with the custom routing you
recommended, here are the things you asked.

### "rake routes" report as following:

          user_index GET /user
{:action=>"index", :controller=>"user"}

formatted_user_index GET /user.:format
{:action=>"index", :controller=>"user"}

                     POST /user
{:action=>"create", :controller=>"user"}

                     POST /user.:format
{:action=>"create", :controller=>"user"}

            new_user GET /user/new
{:action=>"new", :controller=>"user"}

  formatted_new_user GET /user/new.:format
{:action=>"new", :controller=>"user"}

           edit_user GET /user/:id/edit
{:action=>"edit", :controller=>"user"}

formatted_edit_user GET /user/:id/edit.:format
{:action=>"edit", :controller=>"user"}

                user GET /user/:id
{:action=>"show", :controller=>"user"}

      formatted_user GET /user/:id.:format
{:action=>"show", :controller=>"user"}

                     PUT /user/:id
{:action=>"update", :controller=>"user"}

                     PUT /user/:id.:format
{:action=>"update", :controller=>"user"}
                     DELETE /user/:id
{:action=>"destroy", :controller=>"user"}
                     DELETE /user/:id.:format
{:action=>"destroy", :controller=>"user"}
                            /:controller/:action/:id
                            /:controller/:action/:id.:format

### and routes.rb (withoug comments) is as following:

ActionController::Routing::Routes.draw do |map|
  map.resources :user
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
end

By the way I have issue with the register page not the profile page.