rails javascript_include_tag和stylesheet_link_tag上的错误URI

时间:2018-01-16 17:50:13

标签: ruby-on-rails ruby ruby-on-rails-5

所以我花了几个月的时间从这个项目开始,今天去了它并试图托管它,并且没有触及任何东西我在我的javascript和css的两个链接上得到了错误的URI错误。

<%= javascript_include_tag "application", "data-turbolinks-track": "reload" %>

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

这是造成错误的两段代码。有谁知道问题可能是什么,我已经尝试过双/单引号的所有组合,但无济于事。

非常感谢任何帮助!

编辑:

的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. 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 turbolinks
//= require_tree .
//= require jquery-ui




$(window).scroll(function() {
    var distanceFromTop = $(this).scrollTop();
    if (distanceFromTop >= $('.navbar').height()) {
        $('#sticky').fadeIn('1000').addClass('fixed');
    } else {
        $('#sticky').removeClass('fixed');
    }
});



$(document).ready(function() {
    $(".dropdown-toggle").dropdown();
});

Application.css

    /*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *
 *= require_tree .
 *= require_self
 *= require jquery-ui
 */

body {
    font-family: sans-serif;
    background-color: white;
    color: #686868;
}

@media (min-width: 768px) and (max-width: 991px) {
    .navbar-collapse.collapse {
        display: none !important;
    }
    .navbar-collapse.collapse.in {
        display: block !important;
    }
    .navbar-header .collapse, .navbar-toggle {
        display:block !important;
    }
    .navbar-header {
        float:none;
    }




}



* {
    border-radius: 0;
}

.navbar{
    -webkit-border-radius: 0;
    -moz-border-radius: 0;
    border-radius: 0;
}

.navbar .navbar-nav {
    display: inline-block;
    float: none;
    vertical-align: top;
    margin-left: auto;
    padding: 0;
}

.navbar .navbar-collapse {
    text-align: center;
    border-radius: 0;
}

a {
    color: #1b7b90;
}

a:hover {
    color: #1b7b90;
    text-decoration: none;
}

hr {
    border: 0;
    height: 1px;
    background: #333;
    background-image: linear-gradient(to right, #ccc, #333, #ccc);
}

.property-link:hover {
    color: white;
}

.property-fixedbar {
    color: white;
    text-align: center;
    border-style: solid;
    border-width: 1px;
    border-color: white;
    margin-top: 12px;
    padding-top: auto;
}

.property-fixedbar:hover {
    color: #1b7b90;
    background-color: white;
}

.main-content {
    color: #686868;
}

.search-button:hover {
    background-color: black;
}

.table th{
    text-align: center;
}

#sticky {
    z-index: 10;
    height: 67px;
}


#sticky.fixed {
    display: block;
    position: fixed;
    top: 0;
    width: 100%;
}

.navBar-wrapper {
    height: 67px;
}

@media (min-width: 10px) and (max-width: 991px) {
    .navBar-wrapper {
        height: 150px;
    }

    #sticky {
        height: 100px;
    }

    #show-top {
        height: 180px;
    }

    #sticky.fixed {
        position: relative;
    }

    .fixed-summary {
        position: absolute;
        margin: 0;
    }
    .thumbnail-images {
        display: none;
    }
}

.carousel-inner > .item > img,
.carousel-inner > .item > a > img {
    margin: auto;
}

#myCarousel {
    margin-left: 30px;
    margin-right: 30px;
}

.carousel-control {
    padding-top: 25%;
}
.carousel-control.left, .carousel-control.right {
    background: none;
    color: #1b7b90;
    border: none;
}

.hide-bullets {
    list-style:none;
    margin-left: 0;
    margin-top:20px;
}

.thumbnail {
    padding: 0;
}

.carousel-inner>.item>img, .carousel-inner>.item>a>img {
    width: 100%;
}

.green {
    color: green;
}

.red {
    color: red;
}

1 个答案:

答案 0 :(得分:3)

我有完全相同的错误,它让我疯了。

我猜这与URI有关(呃!)我终于将我的项目文件夹从Google Drive移到我的桌面,运行bundle,rails db:migrate,rails assets:precompile然后rails s 。事实证明,为我修好了。