0
votes

creating new application using ruby on rails for EmberJs and when running "rails s" on ubuntu 14.04 getting following error

Extracted source (around line #6):


<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> <%= csrf_meta_tags %>

To resolve above error, tried following cases.
1) As already posted question reading above error
ExecJS::RuntimeError in Users#index (RoR)
a) changed ~/.rvm/gems/[email protected]/gems/execjs-1.4.0/lib/execjs/runtimes.rb
b) changed ~/.rvm/gems/[email protected]/gems/execjs-2.2.2/lib/execjs/runtimes.rb

JScript = ExternalRuntime.new(
    :name        => "JScript",
    :command     => "cscript //E:jscript //Nologo",
    :runner_path => ExecJS.root + "/support/jscript_runner.js",
    :encoding    => 'UTF-8' # CScript with //U returns UTF-16LE
)    

but still getting same error.

2) If commented out //= require vendor in /app/assets/javascripts/application.js. Then above error will disappear. Then getting following errors
TypeError: Ember.ApplicationController is undefined
TypeError: Ember.ApplicationView is undefined

3) if changing

<%= javascript_include_tag 'default', 'data-turbolinks-track' => true %> 
Then getting error NetworkError: 404 Not Found localhost:3000/javascripts/default.js

Setup Details:
1) ruby --version ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]
2) rails --version Rails 4.1.7
3) gem --version 2.4.4
4) nodejs --version v0.10.33

Nothing seems to be work, Can anyone through light to resolve issue?

Thanks to all in advance.

2
The things you are doing tell me that you are completely lost on what is going on, I highly recommend that you follow a rails tutorial.givanse
Thanks @givanse for your help.Manku

2 Answers

0
votes

Working fine with following changes.
1) placed the files[ember.js,handlerbars.js and jquery.js] in /vendor/assets/javascripts.
Note these files were downloaded from http://emberjs.com/ under StartKit.
2) included line //= require_tree ../../../vendor/. under app/assets/javascripts/application.js

0
votes

If you are placing ember js into your vender/assets you're doing it wrong. Most JavaScript libraries are compiled into gems for easier use in Rails and ember is no exception. Try this tutorial instead and use ember-rails or your project will likely have issues down the line.

http://hashrocket.com/blog/posts/setting-up-an-ember-app-with-a-rails-backend

Oh also, make sure to remove the calls to turbolinks cuz that does not place nice with ember