Problem about "no action" error

Hi all,
I'm a ROR newbie. I'm writing ROR application on Ubuntu 10.04, ruby
1.8.7-p249, rails 2.3.5, mongrel 1.1.5. I wrote a controller called
"admin". I also defined a function in the corresponding controller
called "show_admin". But each time I browsed to "http://localhost:3000/
admins/show_admin". I always get the following error:
No action responded to show. Actions: index, login, logout, and
show_admin
It seemed that ror find my action, But it failed to show the action.
On the other hand, it tried to show the "show" action. But I don't
have such an action. I wonder if anyone here can solve my problem. I
searched the internet. I found someone said that it might be related
to the namespacing system. But I can find the detailed description
since it was a google cache.
Thanks for any hints or advice in advance.

What in your routes.rb? if you've got map.resources :admins, then the
routes that get create assume that admins/blah means 'show the admin
with id blah'

Fred

In that action do you want to show all the admins or just one? if you are trying yo list all the admins, you can have a restful route or a named route. please say what you want to do.

kun niu wrote:

Hi all,
I'm a ROR newbie. I'm writing ROR application on Ubuntu 10.04, ruby
1.8.7-p249, rails 2.3.5, mongrel 1.1.5. I wrote a controller called
"admin".

Okay, that is nice...

I also defined a function in the corresponding controller
called "show_admin".

Not so nice... Rails works the best and the easiest if you adhere to
the Rails conventions. You should start with a basic tutorial somewhere
and follow it, trying to understand how it all fits. My favorite way to
get people started is to tell them to scaffold a basic application, then
see what the generator created, and understand how it works. Later,
worry about an admin, or namespacing.

script/generate scaffold person last_name:string first_name:string

(that creates an initial db migration, controller, and views for a
person)

rake db:migrate

(create the table)

script/server

Now browse to your app, and add a person or two, noting which link you
clicked to do what. Now look at the application code AND your log file
to see how Rails is wired togehter

But each time I browsed to "http://localhost:3000/
admins/show_admin". I always get the following error:
No action responded to show. Actions: index, login, logout, and
show_admin
It seemed that ror find my action, But it failed to show the action.

No, that's not correct. Unless you updated your routes.rb file and
restarted your server, you don't have a 'show_admin' routing. And you
shouldn't have one, that very un-Railsy.