0

我正在尝试实现无限滚动并使用jquery.pageless

但我收到了这个错误:undefined method 'pageless'

我在资产中的 application.html.erb 中包含 jquery.pageless.js:

<%= javascript_include_tag 'jquery-1.3.2.min', 'jquery.pageless' -%>

关于如何解决这个问题的任何建议?

4

2 回答 2

1

我不知道您为什么使用以下格式:

<%= javascript_include_tag 'jquery-1.3.2.min', 'jquery.pageless' -%>

在 application.rb 中。

在 assets/javascript/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.
//
// 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 jqeury.pageless
//= require jquery_ujs
//= require_tree .

您需要确保已安装 jquery:

gem install jquery-rails

然后:

bundle install

还要确保在 application.js 文件中提到的路径中包含 jquery-pageless.js 文件,以便它被资产管道拾取。

于 2013-09-05T01:45:44.637 回答
0

应用程序.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.pageless
    //= require jquery_ujs
    //= require turbolinks
    //= require_tree .
于 2013-09-05T01:55:44.543 回答