Reputation: 58284
I have the following rails configuration:
Windows 7
Rails 4.1.1
Ruby 2.0.0p481
Gem: coffee-rails 4.0.1
Gem: coffee-script 2.3.0
Gem: coffee-script-source 1.9.1
I have an application that was working fine, but now doesn't. I don't recall changing anything (git diff
doesn't reveal anything). The error I'm getting is:
TypeError: Object doesn't support this property or method
(in c:/Users/mbratc01/Documents/Rails/manpower/app/assets/javascripts/welcome.js.coffee)
Extracted source (around line #9):
7 <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => false %>
8 <%= javascript_include_tag 'jquery-1.11.1', 'data-turbolinks-track' => false %>
9 <%= javascript_include_tag 'application', 'data-turbolinks-track' => false %>
10 <%= csrf_meta_tags %>
11 </head>
I really have no Coffeescript items going on yet. The contents of welcome.js.coffee
are:
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
I found that if I just move this file to another, inaccessible location, the application runs fine. Also, putting just an empty .coffee
file in the app/assets/javascript
folder generates the same error above.
I've seen a couple of posts here on StackOverflow that looked very similar, but after reading through them, I couldn't find the root cause of my problem nor could I resolve it without just getting rid of the .coffee
file. I suspect there's something not quite right with the CoffeeScript capability setup here, but not sure what that is given that the right gems appear to be installed.
Anyone have a suggestion on what could be causing this error?
Upvotes: 0
Views: 9949
Reputation: 1242
I think renaming extension is not good solution. Try following:
Add to Gemfile
gem 'coffee-script-source', '1.8.0'
then, run
bundle update coffee-script-source
and restart the server (if needed)
Upvotes: 2
Reputation: 786
According tho this, CoffeeScript doesn't play well with Windows. You may want to try downgrading the version of CoffeeScript or completely removing it from your Gemfile.
Then just rename the .coffee
file to a plain .js
and rock regular javascript in your Rails app.
Upvotes: 7