emberjs / emberjs/ember-rails

Naming Collision with Rails' application.js

Open
#339 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
1.3k
Forks
248
PR merge metrics
No merged PRs in 30d

Description

The issue arises when you run `rails generate ember:bootstrap` in a rails project. Rails provides the `application.js` file which the sprockets gem uses as a manifest. The ember-rails gem bootstraps the application with a `applications.js.coffee` file which gets preprocessed to `application.js`. Thus we end up with two `application.js` files. Sprockets will only use one and it seems to choose the one which rails provided. This means the line `window.EmberTest = Ember.Application.create()` never gets run and `window.EmberTest` never gets defined and I'm getting the javascript error: `Uncaught ReferenceError: AppName is not defined`.

The workaround is to rename `application.js.coffee` to something else. When I renamed it to `application_ember.js.coffee` everything worked fine.

To see the bug in action I created a [rails project](https://github.com/p886/ember_bug) in which you can see both the bug and the workaround. I haven't seen any mention of this naming collision so far. Did I do something wrong or is this really a bug?
##

Some stats:
Rails: v4.0.0
Ember-Rails: v.0.14.1
Ember-Source: v.1.3.0

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.