【发布时间】:2017-05-02 21:59:01
【问题描述】:
我正在尝试使用 rails 和 bootstrap-sass 创建一个 webapp。
我按照Ruby On Rails With Bootstrap Tutorial (simple) 的说明安装了那些,它有效。
安装 bootstrap-sass gem 并尝试在浏览器中打开我的应用程序后,ruby/rails 给我一个错误消息。
显示 C:/Sites/bopp/app/views/layouts/application.html.erb 其中第 7 行提出: TypeError: Das Objekt unterstützt dieese Eigenschaft oder Methode nicht.>
参赛作品:
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
根据Ruby on Rails Application coult not include stylesheet nor js我改了,又报错:
显示 C:/Sites/bopp/app/views/layouts/application.html.erb 其中第 7 行提出: 资产管道中不存在资产“default.css”。
条目:
<%= stylesheet_link_tag "default", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "default", "data-turbolinks-track" => true %>
我将 application.css 更改为 application.css.scss。 条目:
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
* vendor/assets/stylesheets directory can be referenced here using a relative path.
* It is generally better to create a new file per style scope.
*
*= require_tree .
*= require_self
*/
@import 'bootstrap-sprockets';
@import 'bootstrap';
Gemfile 中只有一处更改:
gem 'bootstrap-sass'
我没有改变其他任何东西。
然后我跑了bundle install。
Ruby 版本:2.3.3
Rails 版本:5.1.0(从http://railsinstaller.org/en下载)
操作系统:Windows 7
编辑器:Sublime Text 2
浏览器:Mozilla Firefox
【问题讨论】:
-
也许有更多关于“对象不支持此属性或方法”的第一条消息的信息。也许应该是 layouts/application.html.erb 的文件名,特别是第 7 行的内容?
标签: ruby-on-rails ruby bootstrap-sass