Best_in_place is not a functional bug in Rails 3.2.1

I am using the best_in_place gem for my Rails 3.2.1 application. I have no mistakes in my development. When I try to run the application in production, I get a script error

$(".best_in_place").best_in_place is not a function in my browser.

On my browse page, I have the following code

<%= 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>
+3
source share
2 answers

I also had this problem a few minutes ago, solved by moving require best_in_placeto the end, other places will not work. Strange, but it still works.

This is a manifest 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();
})
+4
source

, 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 . config/environments/production.rb. , , best_in_pace.js , ( , jquery.js best_in_place()).

+1

All Articles