1

I'm trying to create a webapp with rails and bootstrap-sass.
I installed those with instructions from Ruby On Rails With Bootstrap Tutorial (simple), which works.

After installing the bootstrap-sass gem, and trying to open my app in the browser, ruby/rails gets me an error msg.

Showing C:/Sites/bopp/app/views/layouts/application.html.erb where line #7 raised: TypeError: Das Objekt unterstützt diese Eigenschaft oder Methode nicht.>

Entries:

<%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>

According to Ruby on Rails Application coult not include stylesheet nor js I changed it, and got another error:

Showing C:/Sites/bopp/app/views/layouts/application.html.erb where line #7 raised: The asset "default.css" is not present in the asset pipeline.

Entries:

<%= stylesheet_link_tag    "default", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "default", "data-turbolinks-track" => true %>

I changed application.css to application.css.scss. Entries:

/*
 * 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';

Only one change in Gemfile:

gem 'bootstrap-sass'

I changed nothing else.

Then I ran bundle install.

Ruby Version: 2.3.3
Rails Version: 5.1.0 (downloaded from http://railsinstaller.org/en)
OS: Windows 7
Editor: Sublime Text 2
Browser: Mozilla Firefox

Community
  • 1
  • 1
Mike G
  • 11
  • 3
  • Maybe some more info about the first message with 'The object does not support this property or method'. Maybe the name of the file which should be layouts/application.html.erb and specifically what is on line 7? – Jake May 02 '17 at 23:33

2 Answers2

0

If I am reading this correctly you need to change default to application.

<%= stylesheet_link_tag    "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>

It is looking for a default.css file but should be looking for your application.css file or your application.js file. By changing your first issue you caused your second one.

Jake
  • 248
  • 2
  • 11
  • Thx for your answer, If I change "default" back to "application" (that is the standard entry) I get the first error msg. As I mentioned, I changed it to "default" because I found that in an other answer on this website. The first error msg is about property and method, and the second is about the asset.css. So, I don't know that to do. – Mike G May 03 '17 at 08:10
0

I solved the problem. I had to remove //= require_tree . from application.js

There is an answer here: enter link description here

Community
  • 1
  • 1
Mike G
  • 11
  • 3