The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

kriston (4) [Avatar] Offline
#1
Hi,

I'm working through the book (up to chapter 5 at the moment), and just realised that my stylesheets aren't working...
Basically, I took a look at the source, and saw this:

<head>
<title>
Ticketee
</title>
<link href="/assets/application.css?body=1" media="all" rel="stylesheet" type="text/css" />
<script src="/assets/jquery.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script>
<script src="/assets/projects.js?body=1" type="text/javascript"></script>
<script src="/assets/application.js?body=1" type="text/javascript"></script>
<meta content="authenticity_token" name="csrf-param" />
<meta content="vJGU5ZaP8ak5CQEQPqlyGGjkYS+a2RQ/PF22PbEtNOk=" name="csrf-token" />
</head>

Then I clicked on the application.css link, and was given a blank page.
Now at this point I started looking around, especially this asset pipeline thing. Don't particularly understand it at this point, but my understanding is that it pulls out asset files (such as JS & CSS) and compiles them into one giant JS or CSS file so that there are less requests.

I saw the post to move the application.css file from app/stylesheets to app/assets/stylesheets and have moved that accordingly. I've also checked that my config.assets.enables = true

So I'm not sure at the moment what I've done wrong... Any help please?

Thanks!
ryanbigg (423) [Avatar] Offline
#2
Re: Trouble with stylesheet
Could you please provide the link for this application on GitHub so I can inspect the code? Thanks.
kriston (4) [Avatar] Offline
#3
Re: Trouble with stylesheet
Hi Ryan,

https://github.com/kriston13/ticketee.git

Here we go...
Thanks! smilie
ryanbigg (423) [Avatar] Offline
#4
Re: Trouble with stylesheet
Alright, I can see the mistake there. You've put the file in app/stylesheets/application.css when it should go into app/assets/stylesheets/application.css, that's all.

Just move the file into app/assets/stylesheets and that'll fix it.

Thanks for reading!
kriston (4) [Avatar] Offline
#5
Re: Trouble with stylesheet
Hi Ryan,

Embarrassingly enough, I did not commit my change to github.... >.<

I did move the file last night as part of me trying to fix it, but didn't occur to me to update git.
At any rate, I have pushed my change through now, but I am still getting the same problem, where the css file just doesn't seem to be identified.

What is strange though, is that each time I press reload on the page, my rails server console throws up this message:

===========================
Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2012-07-02 20:50:34 +1000
Served asset /jquery_ujs.js - 304 Not Modified (0ms)
[2012-07-02 20:50:34] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

===========================

It makes no mention of any other javascript files, nor of the application.css file.

When I go to the new projects page, the console says:

===========================

Started GET "/projects/new" for 127.0.0.1 at 2012-07-02 20:51:51 +1000
Processing by ProjectsController#new as HTML
Rendered projects/_form.html.erb (10.9ms)
Rendered projects/new.html.erb within layouts/application (31.2ms)
Completed 200 OK in 38ms (Views: 37.9ms | ActiveRecord: 0.0ms)
[2012-07-02 20:51:51] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2012-07-02 20:51:51 +1000
Served asset /jquery.js - 304 Not Modified (0ms)
[2012-07-02 20:51:51] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2012-07-02 20:51:51 +1000
Served asset /jquery_ujs.js - 304 Not Modified (0ms)
[2012-07-02 20:51:51] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/projects.js?body=1" for 127.0.0.1 at 2012-07-02 20:51:51 +1000
Served asset /projects.js - 304 Not Modified (0ms)
[2012-07-02 20:51:51] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

===========================

Do you think this might be related?