2016-12-06 4 views
0

こんにちは皆私のアプリケーション用にブートストラップをインストールしましたが、うまく動作していません。私の宝石ファイルは、最後にここにブートストラップ・レールが動作しない

// 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 any plugin's vendor/assets/javascripts directory 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. JavaScript code in this file should be added after the last require_* statement. 
// 
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 
// about supported directives. 
// 
//= require jquery 
//= require jquery_ujs 
//= require bootstrap-sprockets 
//= require turbolinks 
//= require_tree . 

されています:

<!DOCTYPE html> 
<html> 
    <head> 
    <title>BootstrapApp</title> 

    <%= stylesheet_link_tag 'default', media: 'all', 'data-turbolinks-track' => true%> 
    <%= javascript_include_tag 'default', 'data-turbolinks-track' => true %> 
    <%= csrf_meta_tags %> 
    </head> 

    <body> 
     <%= yield %> 
    </body> 
</html> 

application.jsファイル:ここに私のapplication.scssファイルここ

@import "bootstrap-sprockets"; 
@import "bootstrap"; 

は私のapplication.rbファイルです

source 'http://rubygems.org' 

gem 'bootstrap-sass', '~> 3.3.5' 

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '~> 5.0.0', '>= 5.0.0.1' 
# Use sqlite3 as the database for Active Record 
gem 'sqlite3' 
# Use Puma as the app server 
gem 'puma', '~> 3.0' 
# Use SCSS for stylesheets 
gem 'sass-rails', '~> 5.0' 
# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 
# Use CoffeeScript for .coffee assets and views 
gem 'coffee-rails', '~> 4.2' 
# See https://github.com/rails/execjs#readme for more supported runtimes 
# gem 'therubyracer', platforms: :ruby 

# Use jquery as the JavaScript library 
gem 'jquery-rails' 
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 
gem 'turbolinks', '~> 5' 
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 2.5' 
# Use Redis adapter to run Action Cable in production 
# gem 'redis', '~> 3.0' 
# Use ActiveModel has_secure_password 
# gem 'bcrypt', '~> 3.1.7' 

# Use Capistrano for deployment 
# gem 'capistrano-rails', group: :development 

group :development, :test do 
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console 
    gem 'byebug', platform: :mri 
end 

group :development do 
    # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. 
    gem 'web-console' 
end 

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 

ここに私が何を得ているかnは私のウェブページにナビゲーションバーを追加しようとしている:

enter image description here

+0

エラーが起こりましたか?はいの場合は、エラーメッセージを投稿してください。 –

+0

いいえエラーメッセージが表示されません。索引ページに移動すると、テキストは通常​​のhtmlで、ブートストラップはありません。ブートストラップは追加されました。テキストの変更を確認できるはずです。 – Aaron

+0

application.scss/cssからブートストラップスプロケットを削除します。 – Milind

答えて

1

問題は、あなたがapplication.scssapplication.jsを必要としていないです。あなたがObject does not support the property or methodエラーを取得している場合は

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

は、その後、(1.10.0のように)「コーヒー・スクリプト・ソース」の最新の宝石を使用 - バージョン1.9.x.以外のものを

Gemfileに次の行を追加し、bundle installを実行してサーバーを再起動します。

gem 'coffee-script-source', '~> 1.11', '>= 1.11.1' 
+0

まだ...これをインストールした後。それは私に同じ正確なエラーを与える:( – Aaron

+0

@アロンあなたは[this]の最初の答えを試してください(http://stackoverflow.com/questions/28312460/object-doesnt-support-this-property-or-method-rails) -windows-64bit)質問です。少し汚れていますが、うまくいくはずです。 –

0

私はついにこれを動作させました。 this link私の解決策を私に提供しました。この投稿に私を助けてくれた皆様に感謝して、嬉しく思います。

関連する問題