2016-01-22 58 views
0

我下面這個tutorialRails的引導不加載


但登錄的引導和註冊頁面沒有加載。只有我收到上封頭。我不明白這是爲什麼....我也跟着教程正常。就是有自舉
[application.html.erb]

​​


一些問題[pages_Controller]

class PagesController < ApplicationController 
    before_action :require_login, only: [:new] 

    def index 
    end 

    def new 
    end 

end 


[寶石文件]

gem 'rails', '4.2.5' 
# Use sqlite3 as the database for Active Record 
gem 'pg' 
gem 'bootstrap-sass','~> 3.3.5' 
gem 'clearance', '~> 1.11' 

# Use SCSS for stylesheets 
gem 'sass-rails', '~> 5.0' 


[application.scss]

@import 'bootstrap-sprockets'; 
@import 'bootstrap'; 

.navbar-nav > li > span { 
    padding-bottom: 15px; 
    padding-top: 15px; 
    color: #9d9d9d; 
    line-height: 20px; 
    display: block; 
} 

#footer { 
    margin-top: 50px; 
} 

.other-links { 
    margin-top: 10px; 
} 


[application.js中]

// 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. 
// 
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 
// about supported directives. 
// 
//= require jquery 
//= require jquery_ujs 
//= require turbolinks 
//= require_tree . 
+0

你在哪裏加載引導CS/etc?你沒有包含你的應用程序CSS或JS文件。 –

+0

你寫「登錄和註冊頁面不加載」是什麼意思? –

+0

引導登錄和註冊不加載 –

回答

0

嘗試增加你的JavaScript/aplication.js //= require bootstrap-sprockets,看看它是否工作。

//= require jquery 
    //= require jquery_ujs 
    //= require jquery.turbolinks 
    //= require bootstrap-sprockets 
    //= require turbolinks 
    //= require_tree . 

我也推薦使用partial。所以很容易閱讀。例如: 您可以在layouts文件夾中創建一個名爲_navbar.html.erb的文件,並將所有代碼導航欄粘貼到該文件夾​​中。

<%= render 'layouts/navBar' %> 

    <!-- Flash Errors --> 
    <%= render 'layouts/flashErrors' %> 

    <%= yield %> 

    <%= render 'layouts/footer' %> 

更可讀......歡呼的隊友!

+0

好吧讓我試試這一個 –

+0

找不到類型爲'application/javascript'的文件'jquery.turbolinks' –

+0

你有github上的這個項目嗎?想自己測試一下。 – mrvncaragay