我正在關注Michael Hartl's book Ruby on Rails 3 Tutorail中的demo_app。該演示是一個簡單的支架用戶名:字符串email:字符串Javascript不適用於javascrip_inlcue-tag Rails 3.2.2
我得到一個錯誤,在我的application.html.erb文件:
Errno::EINVAL in Users#index
Showing ~/demo_app/app/views/layouts/application.html.erb where line #6 raised:
Invalid argument - cscript //E:jscript //Nologo //U /tmp/execjs20120323-4388-1an85xw-0.js 2>&1
(in ~/demo_app/app/assets/javascripts/users.js.coffee)
3: <head>
4: <title>DemoApp</title>
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
9: <body>
如果我chnage 6號線到:
<%= javascript_include_tag "default" %>
該程序將運行完美,除非它不會允許我刪除用戶(大概是因爲它沒有運行javascript)。
環境信息:〜的
$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [i386-cygwin]
$ rails -v
Rails 3.2.2
內容\ demo_app \程序\資產\ JavaScript的\ users.js.coffee:〜的
# 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://jashkenas.github.com/coffee-script/
內容\ demo_app \程序\資產\ Java腳本\的application.js
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
發佈您的'users.js.coffee'文件。 – James 2012-03-23 20:26:08
你可以發佈app/assets/javascripts/users.js.coffee的內容嗎?同時確保您遵循本書Rails 3.2的版本 - http://ruby.railstutorial.org/ruby-on-rails-tutorial-book?version=3.2 – 2012-03-23 20:27:17
john,確認我正在遵循version = 3.2。 – glennm 2012-03-23 20:51:14