Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby

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?

Thanks.

3 Answers

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

-twiz

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