6

I created a ruby application and the application.html.erb is never loaded (looking at webrick output, I never get "Rendered CLASS/index.html.erb within layouts/application", but "Rendered CLASS/index.html.erb")

CLASS.html.erb never gets loaded either.

Only when explicitly specifying "render :file => 'layouts/application'" in the controller, application.html.erb is loaded.

Can anyone help?

Thanks a lot in advance

Sebastien

2 Answers 2

14

Ensure that you're controller is inheriting from the ApplicationController.

class YourController < ApplicationController
  ...
end
Sign up to request clarification or add additional context in comments.

Comments

0

Add in your ApplicationController

layout :application

Now all of your controller use application like default layout.

5 Comments

class ApplicationController < ActionController::Base protect_from_forgery layout :application end
In another application the ApplicationController looks like that:
class ApplicationController < ActionController::Base protect_from_forgery end
and the rendering is taking application.html.erb into account
This should never be needed as application.html.erb is the default unless you specifically override it.

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.