Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/64.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
Ruby on rails jQuery UI、基础和Rails 3.1不能一起玩得很好_Ruby On Rails_Jquery Ui_Ruby On Rails 3.1_Zurb Foundation - Fatal编程技术网

Ruby on rails jQuery UI、基础和Rails 3.1不能一起玩得很好

Ruby on rails jQuery UI、基础和Rails 3.1不能一起玩得很好,ruby-on-rails,jquery-ui,ruby-on-rails-3.1,zurb-foundation,Ruby On Rails,Jquery Ui,Ruby On Rails 3.1,Zurb Foundation,我有一个Rails 3.1应用程序,它使用了基础Rails gem和jQueryRails gem,一切似乎都正常工作。我尝试将jQueryUIRails gem添加到mix-and-ran捆绑包安装中,一切看起来都很好。以下是我的GEM文件的相关部分: # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3' gem 'mysql2'

我有一个Rails 3.1应用程序,它使用了基础Rails gem和jQueryRails gem,一切似乎都正常工作。我尝试将jQueryUIRails gem添加到mix-and-ran捆绑包安装中,一切看起来都很好。以下是我的GEM文件的相关部分:

# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'
gem 'mysql2'
gem 'devise'
gem 'omniauth'
gem 'omniauth-facebook', '1.4.0'
gem 'omniauth-google-oauth2'
gem 'jquery-rails'

gem 'json'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.1.4'
  gem 'coffee-rails', '~> 3.1.1'
  gem 'uglifier', '>= 1.0.3'
  gem 'foundation-rails'
  gem 'jquery-ui-rails'
end
下面是application.js:

//= require jquery
//= require jquery_ujs
//= require jquery.ui.all
//= require foundation
//= require_tree .

$(function(){ $(document).foundation(); });
下面是application.css:

/*
 * This is a manifest file that'll automatically include all the stylesheets available in this directory
 * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
 * the top of the compiled file, but it's generally better to create a new file per style scope.
 *= require_self
 *= require foundation_and_overrides

 *= require_tree . 
*/

/*
 *= require jquery.ui.all
 */
我有一个包含以下代码的页面:

    <ul id='sortable_list'>
      <% @list.items.each do |item| %>
        <li><%=item.name%></li>
      <%end%>
    </ul>

  </div>
</div>

<script>

  $(function() {
    $( "#sortable_list" ).sortable();
    $( "#sortable_list" ).disableSelection();
  });
</script>
$(函数(){ $(“#可排序列表”).sortable(); $(“#可排序列表”).disableSelection(); });

当页面加载并且我得到“UncaughtReferenceError:$未定义”时,列表不可排序。我束手无策,请救命

>好,所以问题是基金会的当前版本(5.0.2)。文档中说它的脚本标签应该放在结束标签的正前方。我将application.js的script_标记放在那里,显然jQuery喜欢在头部加载。因此,我将
/=require foundation
移出application.js,将
移回头部,并在文档底部添加了
。我想这将一直有效,直到他们修复了5.0.2中要求在正文末尾加载的错误。

您遗漏了应用程序的一部分。css.OK,我加入了整个application.css.Call jQuery,而不是$,它将起作用。在这里看到另一篇文章:我链接到基金会论坛并展示如何做的例子。