4

I'm having an unexplainable issue with my Rails app. I'm using a lot of JavaScript in all parts of the app. In development everything is working just fine, but in production it seems that the code in my javascript views is not executed.

This is particularly odd because all other JavaScript on the page works great. Custom tabs with JavaScript work. Even my custom made calendar works as expected. The only things that do not work are remote links which trigger views ending with .js.coffee.

My webkit inspector returns this when clicking a remote link: http://cl.ly/Ihyf

However, when looking at the response tab of that request it shows me nothing: http://cl.ly/Ihxs

Furthermore, the console does not show any errors. It's as if my new.js.coffee is just empty.

The view that is being called contains some simple JavaScript to show a modal:

$('#modal_container').html("<%=j render 'form' %>")
$('#modal_container').modal()

In development mode, all views load properly. I also ran rake:assets:precompile multiple times, but that didn't seem to help.

2
  • 1
    try to move coffee-rails gem from :assets gropu to main group. Commented Aug 12, 2012 at 21:34
  • 1
    Doh! Foolish me trying to use coffeescript out of the asset pipeline and expecting it to work out of the box. Thanks, it's fixed now! Please add it as an answer ^^ Commented Aug 12, 2012 at 21:40

1 Answer 1

8

You should move coffee-rails gem from the :assets group to the main group.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.