2016-01-22 53 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