Problematic admin/views

ok, i have a pretty almost finished (frontend) blog, i have defined an
admin zone with authentication to add content, now im getting trouble
with the views for the controllers in the admin zone, here you can see
my file structure:

and my admin controllers like this:

class Admin::AdminController < ApplicationController


class Admin::ArticlesController < Admin::AdminController


both works fine, the problem are the views, for example the
controllers/articles_controller.rb takes the view from
views/layouts/articles.rhtml no problem, so the
controllers/admin/articles_controller.rb should take the view from but
views/admin/layouts/articles.rhtml but isnt taking any view¡¡ not from
there not from any place or folder in the admin view zone that i put the
articles.rhtml file.

but it does take the little files that are usually called from
@content_for_layout(show.rhtml, edit.rhtml, etc.) so i can add,delete,
edit items without problems(if i see the source html of the browser i
only see this part of htmlcode not a complete html page) but what is
happening, why arent taking a main view?

note: the problem its present on every controller that i create on the
admin zone, and when i create the admin/articles_controller.rb the
views/layouts/articles.rhtml(the frontend controller view) its

well,i have been working on this for a while and now im clueless about
this, hope someone acn help with this, any help will be very apreciated.


So the views that work for Admin::ArticlesController are in
“app/admin/articles/.rhtml" and the ones that don;t work are in

Views for ArticlesController: app/views/articles
Views for Admin::ArticlesController: app/views/admin/articles

See how that works?

As for the layout, I don’t believe you can put layouts in a subfolder
like that. I think the only layouts treated as layouts are in

So create a file called “admin_articles.rhtml” in “app/views/layouts”,
and then in your Admin::ArticlesController put this near the top

layout: admin_articles

by the naming conventions that are so mentioned, and using simple logic
i thought that if a controller created in /controllers have its main
view on /views/layouts, then a controller created on /controllers/admin
will have its view on /views/admin/layout but well, weird rails thing.

now my layouts worked defining layout: admin/articles(i have
articles.rhtml inside /views/admin).

Many thanks for this Alex :wink: