# Problem about "no action" error

**URL:** <https://www.ruby-forum.com/t/problem-about-no-action-error/195228>\
**Category:** Rails\
**Created:** [September 20, 2010, 9:24am UTC](https://www.ruby-forum.com/t/problem-about-no-action-error/195228 "2010-09-20T09:24:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kun\_niu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/8c91f0/32.png) [@kun\_niu](https://www.ruby-forum.com/u/kun_niu)\
**Post date:** [September 20, 2010, 9:24am UTC](https://www.ruby-forum.com/t/problem-about-no-action-error/195228/1 "2010-09-20T09:24:54Z")

</div>

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/](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.

---

<div class="post-metadata">

**Author:** ![kun\_niu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/8c91f0/32.png) [@kun\_niu](https://www.ruby-forum.com/u/kun_niu)\
**Post date:** [September 20, 2010, 12:10pm UTC](https://www.ruby-forum.com/t/problem-about-no-action-error/195228/2 "2010-09-20T12:10:34Z")

</div>

On Sep 20, 5:17 am, kun niu [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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.

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

---

<div class="post-metadata">

**Author:** ![kun\_niu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/8c91f0/32.png) [@kun\_niu](https://www.ruby-forum.com/u/kun_niu)\
**Post date:** [September 20, 2010, 1:27pm UTC](https://www.ruby-forum.com/t/problem-about-no-action-error/195228/3 "2010-09-20T13:27:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kun\_niu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/8c91f0/32.png) [@kun\_niu](https://www.ruby-forum.com/u/kun_niu)\
**Post date:** [September 20, 2010, 6:42pm UTC](https://www.ruby-forum.com/t/problem-about-no-action-error/195228/4 "2010-09-20T18:42:13Z")

</div>

Hi kun niu,

I think, this is common problem for all ROR beginners.

First you check it out, following.

app/controllers =\> admin\_controllers.rb  
app/views =\> admin/\<.rhtml (i.e admin/show\_admin.rhtml,  
admin/login.rhtml, etc…)

In admin\_controller.rb like follow

class AdminController \< ApplicationController  
def show\_admin  
#your content  
end  
def login  
#your content  
end  
def \<\<\>\>  
#your content  
end  
end

then open your browser, type in the address bar =\> “[http://localhost](http://localhost):  
3000/admin/show\_admin”. I hope this will solve your problem.

---

<div class="post-metadata">

**Author:** ![kun\_niu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/8c91f0/32.png) [@kun\_niu](https://www.ruby-forum.com/u/kun_niu)\
**Post date:** [September 20, 2010, 1:35pm UTC](https://www.ruby-forum.com/t/problem-about-no-action-error/195228/5 "2010-09-20T13:35:14Z")

</div>

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/](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.

> 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.
