# Controller in subfolder help

**URL:** <https://www.ruby-forum.com/t/controller-in-subfolder-help/173454>\
**Category:** Rails\
**Created:** [August 9, 2009, 5:05pm UTC](https://www.ruby-forum.com/t/controller-in-subfolder-help/173454 "2009-08-09T17:05:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![little\_kostas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f9ae1b/32.png) [@little\_kostas](https://www.ruby-forum.com/u/little_kostas)\
**Post date:** [August 9, 2009, 5:05pm UTC](https://www.ruby-forum.com/t/controller-in-subfolder-help/173454/1 "2009-08-09T17:05:35Z")

</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|  
admin.resources :books  
end  
…

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

…  
\<% for book in @books %\>

 \<%=h book.title %\> \<%=h book.description %\> \<%= link\_to 'Show', book %\> \<%= link\_to 'Edit', edit\_admin\_book\_path(book) %\> \<%= link\_to 'Destroy', book, :confirm =\> 'Are you sure?', :method =\> :delete %\> \<% 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:** ![little\_kostas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f9ae1b/32.png) [@little\_kostas](https://www.ruby-forum.com/u/little_kostas)\
**Post date:** [August 10, 2009, 1:54pm UTC](https://www.ruby-forum.com/t/controller-in-subfolder-help/173454/2 "2009-08-10T13:54:47Z")

</div>

Hi Kostas L.

Read this thread

[http://www.ruby-forum.com/topic/192938](http://www.ruby-forum.com/topic/192938)

Sijo

---

<div class="post-metadata">

**Author:** ![little\_kostas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f9ae1b/32.png) [@little\_kostas](https://www.ruby-forum.com/u/little_kostas)\
**Post date:** [August 11, 2009, 7:34am UTC](https://www.ruby-forum.com/t/controller-in-subfolder-help/173454/3 "2009-08-11T07:34:49Z")

</div>

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

Kostas
