0

I'm new to Rails (coming from .Net). My web app is supposed to pick up and include the /app/assets/stylesheets/application.css file. The haml file is displayed without the css markup and without any notation of including the css file.

This is a bare bones site with not many files. Where is the config to make sure the haml brings in the css file and displays the final page with css formatting?

2 Answers 2

1

Layout which is used by your view has to include = stylesheet_link_tag "application". If you haven't changed anything, it must be in app/views/layouts/application.html.haml.

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

5 Comments

That line is there: = stylesheet_link_tag 'application'
Ok, getting closer to the problem. None of the markup in application.html.haml is displayed in browser. So the app level markup isn't getting pulled in. Where is that configured?
OK, I solved it by adding: layout "application" to the top of my file but I thought the idea was if a controller didn't have a corresponding layout, that the application layout was used by default.
It had to be used by default, see guides.rubyonrails.org/…. Unfortunately there's too much guessing unless you show your application code.
Final solution is: change xxx_controller to inherit from ApplicationController instead of ActionController::Base.
0

Final solution is: change xxx_controller to inherit from ApplicationController instead of ActionController::Base.

1 Comment

Two changes actually. 1st was to have individual controller inherit from ApplicationController. Then in ApplicationController, I needed to specify the layout such as layout "application"

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.