0

Railsを使い始めたばかりです。

アセット javascripts 内には、次のようなファイル (welcome.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://coffeescript.org/

この関数をすぐ下に配置しました

$(document).ready ->
    alert "Hello World"

私のapplication.jsファイル内に、

//= require welcome

アラートが表示されます。それ以外の場合は表示されません。

私は何かをスキップしていますか、またはwelcome.js.coffeeファイルがアプリケーション.jsでロジックが自動的に利用可能になると言っていますが、ファイルを手動で要求する必要がありますか?

4

1 に答える 1

0

あなたのapplication.jsすべきリスト

//= require_tree .

そのファイルが存在するディレクトリ ツリー内の他のすべてのファイルを必要とする行の 1 つとしてwelcome。仕事。

于 2013-07-06T06:18:04.037 に答える