# Controller in subfolder help

**URL:** <https://discuss.rubyonrails.org/t/controller-in-subfolder-help/44977>\
**Category:** rubyonrails-talk\
**Created:** [August 9, 2009, 3:04pm UTC](https://discuss.rubyonrails.org/t/controller-in-subfolder-help/44977 "2009-08-09T15:04:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Konstantinos\_Loupos](https://avatars.discourse-cdn.com/v4/letter/k/96bed5/32.png) [@Konstantinos\_Loupos](https://discuss.rubyonrails.org/u/Konstantinos_Loupos)\
**Post date:** [August 9, 2009, 3:04pm UTC](https://discuss.rubyonrails.org/t/controller-in-subfolder-help/44977/1 "2009-08-09T15:04:37Z")

</div>

Hi guys, i've created a scaffold in an admin folder. the folders are app/ controllers/admin/books\_controller and app/views/admin/index, new etc... I changed routes.rb to look like this:

... map.resources :books .... map.namespace :admin do |admin| &nbsp;&nbsp;&nbsp;&nbsp;admin.resources :books &nbsp;&nbsp;end ...

But i am having problems with the actions inside index.hmtl.erb. This is my view(scaffold):

... \<% for book in @books %\> &nbsp;&nbsp;\<tr\> &nbsp;&nbsp;&nbsp;&nbsp;\<td\>\<%=h book.title %\>\</td\> &nbsp;&nbsp;&nbsp;&nbsp;\<td\>\<%=h book.description %\>\</td\> &nbsp;&nbsp;&nbsp;&nbsp;\<td\>\<%= link\_to 'Show', book %\>\</td\> &nbsp;&nbsp;&nbsp;&nbsp;\<td\>\<%= link\_to 'Edit', edit\_admin\_book\_path(book) %\>\</td\> &nbsp;&nbsp;&nbsp;&nbsp;\<td\>\<%= link\_to 'Destroy', book, :confirm =\> 'Are you sure?', :method =\> :delete %\>\</td\> &nbsp;&nbsp;\</tr\> \<% end %\> ...

\<%= link\_to 'New book', new\_admin\_book\_path %\>

'New\_book' and 'Edit' works but others does not work.When i change in 'Show' action the book to admin\_book(helper method) i get an error. What changes do i have to make to the code to make it work??

Thanx in advance Kostas L.

---

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [August 10, 2009, 11:54am UTC](https://discuss.rubyonrails.org/t/controller-in-subfolder-help/44977/2 "2009-08-10T11:54:47Z")

</div>

Hi Kostas Lps

&nbsp;&nbsp;&nbsp;Read this thread

> **[Scaffolding in a sub-directory on Rails 2.x](https://www.ruby-forum.com/t/scaffolding-in-a-sub-directory-on-rails-2-x/173358)**
>
> Hi, I’m trying to make an app using rails 2.x, but when I try to generate scaffold it messes up with several errors. For example, I want to make an scaffold this way, localhost:3000/admin/publisher, but I don’t know how I can generate it; I was...

Sijo

---

<div class="post-metadata">

**Author:** ![Konstantinos\_Loupos](https://avatars.discourse-cdn.com/v4/letter/k/96bed5/32.png) [@Konstantinos\_Loupos](https://discuss.rubyonrails.org/u/Konstantinos_Loupos)\
**Post date:** [August 11, 2009, 5:33am UTC](https://discuss.rubyonrails.org/t/controller-in-subfolder-help/44977/3 "2009-08-11T05:33:46Z")

</div>

Thank u very much Sijo that really helped!! I totally understood what should i do!

Kostas
