0

I have an application with a namespace 'admin'.

I created my views on a folder called admin->highligths. And want that, when my views are rendered, it gets the layout from 'admin/layouts/application'.

But, when I render my pages, it is getting from the base layout folder.

  Rendered admin/highlights/index.html.erb within layouts/application (0.7ms)

My routes are like this:

namespace :admin do root 'pages#show', id: 'dashboard'

resources :events
resources :invitees do
  collection do
    get 'import_invitees/:year' => 'invitees#import_invitees', as: :import_invitees
  end
end
resources :highlights
resources :pages
resources :speakers
resources :sponsors
resources :users
resources :years do
  resources :events do
    resources :photos
  end
end

end

All my other views (sponsours, invitees, etc...) are getting the template from 'admin/layouts/application' , but highlight (the new one I created)only render with the 'layouts/application'.

What Im missing here?

1 Answer 1

2

There are multiple possibilites. In the dark, I would assume that your other Controllers inherit from an AdminController (or similar), that defines the layout, but the "new one" does not.

For reference about how to make controllers use certain layouts by defaults: http://guides.rubyonrails.org/layouts_and_rendering.html

Sign up to request clarification or add additional context in comments.

1 Comment

Was exactly that Felix.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.