RoR 4.2.0 Jquery未定义

时间:2015-05-28 11:06:46

标签: javascript jquery ruby-on-rails ruby

在我的ror应用程序中,执行期间发生了jquery错误。在Google Chrome应用中,会显示此消息

  

未捕获的ReferenceError:未定义jQuery

这是我的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
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require foundation
//= require turbolinks
//= require_tree .


$(function(){ 
    $(document).foundation('alert'); 
});

在gemfile中出现了jquery-rails gem。

我真的不知道在哪里粉碎我的脑袋。感谢所有帮助

1 个答案:

答案 0 :(得分:-1)

删除Gemfile.lock 做

$bundle install

现在检查jQuery是否有效