Roman
Roman

Reputation: 10403

Why does the layout for rails project get ignored?

I've attached a picture of my project which I just created. Even though the application.html.erb is present my template ignores it and the page is rendered without the surrounding html inside the layout.

I have even tried to specify the layout using the layout option in my controller without success.

The project was generated with --skip-active-record flag because I'm using mongodb without an ORM. I don't think this has anything to do with it. Right??

enter image description here

Upvotes: 0

Views: 84

Answers (1)

Roman
Roman

Reputation: 10403

Worked out the problem.

In my controller I had defined a new constructor which didn't call its super class like so:

def initialize
    @default_report_days = 30
end

Once the controller was correctly initialised the layout started being picked up.

def initialize
    super
    @default_report_days = 30
end

Upvotes: 1

Related Questions