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


Rails Tutorial: coffeescript not being recognized.

I am doing the Rails Tutorial "Treebook". I am at the part where we are adding coffeescript in the statuses.js.coffee file. I am adding the following like it is telling me to do:

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

and when I hover over in my browser it is not acknowledging it at all. I am using Sublime Text 2 as well and the colors of my text in the texteditor are not changing when they should be like functions, etc. Any advice on what I should do to fix this problem?


3 Answers

What does errors do the console say when you are hovering over the .status class?


It's getting no errors or anything. Its like its not even recognizing the file. I followed along with the tutorial exactly so I'm not sure why it wouldn't load. I'm not quite sure. Any thoughts?

David Woody
David Woody
8,671 Points

I got an error on this part too, and it was due to the fact that I had not added the "hover" class properly to the span containing the "Edit" and "Delete" links in the index.html.erb file.

<span class="admin hover">

Once I fixed that, I was back on track.

Wow it was as easy a simple indention error.

I had:

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

When it needed to be:

$ -> $('.status').hover (event) -> $(this).toggleClass('hover') (<---this line is indented)

Thanks for the help!!

It could be also because coffee script was not installed along with the current version of sublime text, faced a similar problem