Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

TreeBook Refresh w warnings...

I'm at a bit of a loss here. The TreeBook app is looking good but I'm running into an issue that I can't figure out. I see the issue of the yellow box with no message appearing in the pages but want to get this sorted out before I move on and tackle that.

The link 'TreeBook' works fine however when I move over to the 'All Statuses' link, the hover action we previously did doesn't work. In other words, the '| Edit | Destroy' links do not appear until I refresh the page.

In looking at the console of rails server or 'rails s', I see the warnings below. Once I refresh the page, [these hover links appear properly.

Any advice or help would be appreciated. https://github.com/mnickey/Treebook.git]

---Warning Logs Copied from rails server--- Completed 200 OK in 14ms (Views: 12.7ms | ActiveRecord: 0.3ms) [2013-09-23 22:37:00] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

Started GET "/assets/scaffolds.css?body=1" for 127.0.0.1 at 2013-09-23 22:37:00 -0700 [2013-09-23 22:37:00] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-23 22:37:00 -0700 [2013-09-23 22:37:00] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

Started GET "/assets/bootstrap.css?body=1" for 127.0.0.1 at 2013-09-23 22:37:00 -0700 [2013-09-23 22:37:00] 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 2013-09-23 22:37:00 -0700 [2013-09-23 22:37:00] 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 2013-09-23 22:37:00 -0700 [2013-09-23 22:37:00] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

Started GET "/assets/statuses.css?body=1" for 127.0.0.1 at 2013-09-23 22:37:00 -0700 [2013-09-23 22:37:00] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

Started GET "/assets/turbolinks.js?body=1" for 127.0.0.1 at 2013-09-23 22:37:00 -0700 [2013-09-23 22:37:00] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

Started GET "/assets/statuses.js?body=1" for 127.0.0.1 at 2013-09-23 22:37:00 -0700 [2013-09-23 22:37:00] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

Started GET "/assets/bootstrap.js?body=1" for 127.0.0.1 at 2013-09-23 22:37:00 -0700 [2013-09-23 22:37:00] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-23 22:37:00 -0700 [2013-09-23 22:37:00] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

3 Answers

Rodrigo Medeiros
PLUS
Rodrigo Medeiros
Courses Plus Student 2,952 Points

Hi Michael,

Have you checked the Chrome console when you hover over your status? It might be a Javascript error.

Interesting, I have checked this but the hover class doesn't seem to be working in the console.

$ ->
    $('.status').hover (event) ->
        console.log("Hover triggered")
            $(this).toggleClass("hover")

I'll have to re-watch this video to make sure I have it working correctly. Now if I can only find that video... I'll update with the results if any and thanks for the idea.

Re-watching the video, I cannot get this to trigger when hovering over the list. However I'm not sure this is the true nature of the issue. I could be wrong (it's happened before) but for some reason this is just not working as expected and I cannot figure it out.

Rodrigo Medeiros
Rodrigo Medeiros
Courses Plus Student 2,952 Points

HI Michael,

I don't know for sure if coffeescript cares about the indentation of the code, but if it does, you could try to fix the indentation in you code, like:

$ ->
    $('.status').hover (event) ->
        console.log("Hover triggered")
        $(this).toggleClass("hover")

Thanks Rodrigo, I changed the indentation and this still doesn't take effect when the hover action is called.

$ ->
    $('.status').hover (event) ->
        console.log("Hover triggered")
        $(this).toggleClass("hover")
Rodrigo Medeiros
Rodrigo Medeiros
Courses Plus Student 2,952 Points

Ok Michael. It's not that simple then. I'll try to fork your project in Github and take a look in it, to see if I can figure out what is going on. I just can't do it right now, because I'm at my job. Maybe tonight, or tomorrow, if you don't find the bug till there.

Rodrigo Medeiros
Rodrigo Medeiros
Courses Plus Student 2,952 Points

Hi Michael,

As you may have noticed, I forked you repo on Github to see if I was able to find the problem. And what I discovered was just a configuration problem. I saw that you've included the turbolinks gem. I'm really new in the RoR world, and I don't know anything about this gem. So, for now, I just removed the include instruction for that and submitted a pull request to your repository. Now it's woking properly.

Wow that's amazing. I'm really unsure how that got in there let alone how you found that.

Really, How did you figure that out? The reason I ask is so I don't have to ask again and can debug these myself in time.

Thanks so much!

Rodrigo Medeiros
Rodrigo Medeiros
Courses Plus Student 2,952 Points

Hi Michael,

I think: well, when you refresh the whole page, you get the right javascript, but when you click on a link that should have doing the same thing, since it's the same url, we may have facing some kind of routing or caching problem. I compared our routes.rb files and they were equal. Since, following the instructions on the videos, I didn't remember to include any caching feature, I figured out that there must be something different bettween your app and mine. And I started to compare both Gemfiles and found the turbolinks gem. No magic, just trial and error.

On top of Rodrigo's advice I also found why my console log wasn't triggering. I had all the filters in the browsers logging turned off. After checking the filters and making sure that they were all unchecked was not the way to go. Make sure that what you want to see in the 'inspector' is checked, in Chrome, this will turn the filter icon from blue to grey.

Ok, back to coding! Thanks all!