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 Build a Simple Ruby on Rails Application Creating an Authentication System Generating the Devise Views

Alex Lowe
Alex Lowe
15,147 Points

Noticing a problem with .status.hover

Maybe this is addressed later in the course, but I'm noticing that my styling for .status.hover doesn't seem to work in certain situations. It works fine when the statuses page is freshly loaded, however when I come to the page from the back link on an edit page it doesn't seem to work. The admin links remain hidden and the color change doesn't happen either.

How can I fix this?

This is from my statuses.scss file:

    border-bottom: solid 1px #CCC;
    padding: 5x 0;

.status p{
    margin: 4px 0;

.status.hover {
    background: #FAFAFA;

.status .admin {
    display: none;

.status.hover .admin {
    display: inline;

And this is from the coffeescript:

$ ->
    $('.status').hover (event) ->

1 Answer

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

This is caused by turbolinks. When you load a fresh page, that triggers a different event than when you go to that page through a link. It was designed to make the page faster, but has some side effects. You just have to set up your function to respond to standard page load AND turbolink events. This should help you: http://stackoverflow.com/questions/18770517/rails-4-how-to-use-document-ready-with-turbo-links