# Problem with links

**URL:** <https://www.ruby-forum.com/t/problem-with-links/174509>\
**Category:** Rails\
**Created:** [August 27, 2009, 9:55pm UTC](https://www.ruby-forum.com/t/problem-with-links/174509 "2009-08-27T21:55:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![RubyonRails\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9d8465/32.png) [@RubyonRails\_newbie](https://www.ruby-forum.com/u/RubyonRails_newbie)\
**Post date:** [August 27, 2009, 9:55pm UTC](https://www.ruby-forum.com/t/problem-with-links/174509/1 "2009-08-27T21:55:12Z")

</div>

Hello all…

I am on Chapter 4 of RailsSpace and I have hit a problem when it comes  
to linking in the document.

To start with in an earlier chapter I created a page called site.rhtml  
which used these attributes:  
\<%= link\_to\_unless\_current “Home”, :action =\> “index” %\> |  
\<%= link\_to\_unless\_current “About Us”, :action =\> “about” %\> |  
\<%= link\_to\_unless\_current “Help”, :action =\> “help” %\>

This is in the site class that was created (localhost:3000/site/index)

All these links work a treat - basic i know, but all work in progress.

NOw on Chapter 4, it’s time to create a page to register users.  
I have a page now (localhost:3000/user/register)

However, for some reason, the links no longer work, despite me  
updating the main file from site.rhtml to application.rhtml as the  
RailsSpace book suggests.

If I am on the register page, and click ‘help’ I get the following:

No action responded to help. Actions: index and register

I understand how the links work from the site view, but when  
navigating to the localhost/user/register I get a bit lost, and am  
unsure how to put it right so the lnks do work…

Any ideas???

cheers

---

<div class="post-metadata">

**Author:** ![RubyonRails\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9d8465/32.png) [@RubyonRails\_newbie](https://www.ruby-forum.com/u/RubyonRails_newbie)\
**Post date:** [August 28, 2009, 12:17am UTC](https://www.ruby-forum.com/t/problem-with-links/174509/2 "2009-08-28T00:17:28Z")

</div>

2009/8/27 RubyonRails\_newbie [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Â \<%= link\_to\_unless\_current “Help”, Â Â Â Â Â Â :action Â Â =\> “help” Â %\>  
> RailsSpace book suggests.
> 
> If I am on the register page, and click ‘help’ I get the following:
> 
> No action responded to help. Actions: index and register

Assuming I understand, you have a help link on the user/register page  
as you have shown above on the site/index page. Since in this link  
you have specified only the action this will attempt to call that  
action (help) on the current controller, ie user. Since you have only  
provided index and register actions you get the message shown. Either  
you must provide a help action on the user controller, or if you want  
to call the help action on the site controller then specify  
:controller =\> “site” in the link as well as the action.

Hope this helps

Colin

---

<div class="post-metadata">

**Author:** ![RubyonRails\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9d8465/32.png) [@RubyonRails\_newbie](https://www.ruby-forum.com/u/RubyonRails_newbie)\
**Post date:** [August 28, 2009, 1:10am UTC](https://www.ruby-forum.com/t/problem-with-links/174509/3 "2009-08-28T01:10:09Z")

</div>

Do you know how that is achieved?

I was assuming the page (application.rhtml) is used as the template  
for the whole site, so wasn’t expecting to have to configure the links  
throughout the site.

I’m new to this, so it’s probably easy - but i’m maybe looking at it  
from the wrong angle.

So - if the links currently work at: [http://localhost:3000/site/about](http://localhost:3000/site/about)

what exactly should the pages look like if the link looks like:  
[http://localhost:3000/user/register](http://localhost:3000/user/register)

does the action need adding to the user action, or the register?

---

<div class="post-metadata">

**Author:** ![RubyonRails\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9d8465/32.png) [@RubyonRails\_newbie](https://www.ruby-forum.com/u/RubyonRails_newbie)\
**Post date:** [August 28, 2009, 1:43am UTC](https://www.ruby-forum.com/t/problem-with-links/174509/4 "2009-08-28T01:43:33Z")

</div>

The user controller needs to have the register action. Also run  
rake:routes to make sure you’ve got wired correctly.

---

<div class="post-metadata">

**Author:** ![RubyonRails\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9d8465/32.png) [@RubyonRails\_newbie](https://www.ruby-forum.com/u/RubyonRails_newbie)\
**Post date:** [August 28, 2009, 2:33am UTC](https://www.ruby-forum.com/t/problem-with-links/174509/5 "2009-08-28T02:33:53Z")

</div>

cheers for the notes…

I found it eventually.

Updated to:

\<%= link\_to\_unless\_current “Home”, :action =\> “index”,  
:controller =\> “site” %\> |

this seems to work now… (phew!)

cheers

---

<div class="post-metadata">

**Author:** ![RubyonRails\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9d8465/32.png) [@RubyonRails\_newbie](https://www.ruby-forum.com/u/RubyonRails_newbie)\
**Post date:** [August 28, 2009, 2:16am UTC](https://www.ruby-forum.com/t/problem-with-links/174509/6 "2009-08-28T02:16:55Z")

</div>

Oh, and the links you posted in the first post don’t specify a  
controller so it assumes those actions all belong to the current  
controller which obviously is not the case…so you need to add the  
site controller to the links:

\<%= link\_to\_unless\_current “Help”, :controller =\> ‘site’, :action =\>  
‘help’ %\>
