Linking to subdirectories in controller

How do I link (with link_to) to a controller and action inside a
subdirectory in controllers? I get an error saying “Unknown action. No
action responded …”.

And do I understand it correctly that I need to have a similar
subdirectory in views as well?

Pål Bergström wrote:

How do I link (with link_to) to a controller and action inside a
subdirectory in controllers? I get an error saying “Unknown action. No
action responded …”.

link_to :controller => ‘/admin/products’, :action => ‘list’

And do I understand it correctly that I need to have a similar
subdirectory in views as well?

That is correct.

Note that the behavior seems to be generally discouraged as it has led
to unpredictable behavior before. (Search the archives for relevant
discussions.)

  • Roderick

Roderick van Domburg wrote:

Pål Bergström wrote:

How do I link (with link_to) to a controller and action inside a
subdirectory in controllers? I get an error saying “Unknown action. No
action responded …”.

link_to :controller => ‘/admin/products’, :action => ‘list’

And do I understand it correctly that I need to have a similar
subdirectory in views as well?

That is correct.

Note that the behavior seems to be generally discouraged as it has led
to unpredictable behavior before. (Search the archives for relevant
discussions.)

  • Roderick

Thanks. Yes I’ve seen that after reading here. I think I’ll leave it as
I had it with one level.

Roderick van Domburg wrote:

Note that the behavior seems to be generally discouraged as it has led
to unpredictable behavior before. (Search the archives for relevant
discussions.)

What I don’t understand is how to deal with the public view and the
admin part. Let’s say I have a users table. To that I have a user model.
But what if I want to keep the user controller just for admin and
another controller for login. Can I create what ever controllers I want
but tell it to use a certain model? Or does it always have to have a
correlation, name-wise?

Pål Bergström wrote:

What I don’t understand is how to deal with the public view and the
admin part. Let’s say I have a users table. To that I have a user model.
But what if I want to keep the user controller just for admin and
another controller for login. Can I create what ever controllers I want
but tell it to use a certain model? Or does it always have to have a
correlation, name-wise?

Every model is available in every controller. They’re not linked
namewise.

  • Roderick

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs