Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery Rails 3.2.1中的最佳位置不是函数错误_Jquery_Ruby On Rails 3_Rubygems_Inplace Editing_Best In Place - Fatal编程技术网

Jquery Rails 3.2.1中的最佳位置不是函数错误

Jquery Rails 3.2.1中的最佳位置不是函数错误,jquery,ruby-on-rails-3,rubygems,inplace-editing,best-in-place,Jquery,Ruby On Rails 3,Rubygems,Inplace Editing,Best In Place,我正在为我的Rails 3.2.1应用程序使用最好的gem。我的发展没有错误。当我试图在生产环境中运行应用程序时,我遇到了一个脚本错误 $(".best_in_place").best_in_place is not a function in my browser. 在我的视图页面中,我有以下代码 <%= stylesheet_link_tag "best_inplace", "jquery-ui-1.8.20.custom" %> <%= javascript_inclu

我正在为我的Rails 3.2.1应用程序使用最好的gem。我的发展没有错误。当我试图在生产环境中运行应用程序时,我遇到了一个脚本错误

$(".best_in_place").best_in_place is not a function in my browser.
在我的视图页面中,我有以下代码

<%= stylesheet_link_tag "best_inplace", "jquery-ui-1.8.20.custom" %>
<%= javascript_include_tag "application", "jquery.dataTables.min" %>


<%= best_in_place @user, :description, :type => :textarea %>

<script>
  jQuery(".best_in_place").best_in_place();
</script>

:text区域%>
jQuery(“.best_in_place”).best_in_place();

我在几分钟前也遇到了这个问题,通过将
要求最佳位置
移到最后解决了这个问题,其他位置将不起作用。很奇怪,但还是管用

这是
application.js
清单

//= require jquery
//= require jquery_ujs
//= require jquery.purr
//= require_tree .
//= require i18n
//= require i18n/translations
//= require best_in_place

$(document).ready(function() {
  $('.best_in_place').best_in_place();
})

问题是函数
best_in_place()?
best_in_pace.js
中声明,在执行
application.js
调用
best_in_place()
中的代码时,可能仍需要加载该函数。正确的解决方案是通过连接实现js文件的连接。这可以通过包括

config.assets.debug = false
和/或删除

config.assets.debug = true
config/environments/development.rb
resp
config/environments/production.rb
。那么,
包含
best_in_pace.js
的位置并不重要(只要它位于
jquery.js
之后,在调用
best_in_place()
的代码之前)。

样式表链接标签
best_in place
缺少下划线
\u place
否…正确。这是我正在使用的样式表。您需要向我们展示您的application.js。这里的问题是,“为什么我的页面中没有
best\u in\u place
呢?”是的,这是真的,我之前也遇到过这种情况。