1
votes

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

2
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

2 Answers

0
votes

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.

0
votes

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

There is an answer here: enter link description here