sprockets :: Asset

时间:2016-11-01 09:25:36

标签: ruby-on-rails ruby

我在stylesheets/application文件中加载javascripts/applicationslayout/application.haml时遇到问题。当我输入"rails s"并刷新页面时,我看到以下错误:

从log / development.log文件

中记录
ActionView::Template::Error (undefined method `pathname' for #<Sprockets::Asset:0x00000005375e10>):
     5:     %meta{ content: 'IE=Edge,chrome=1', 'http-equiv' => 'X-UA-Compatible' }/
     6:     %meta{ content: 'width=device-width, initial-scale=1.0', name: 'viewport' }/
     7:     = csrf_meta_tags
     8:     = stylesheet_link_tag 'application', media: 'all'
     9:     = javascript_include_tag 'application'
    10: 
    11:   %body
  app/views/layouts/application.html.haml:8:in `_app_views_layouts_application_html_haml__541114027848535829_70097966813720'

视图/布局/ application.haml

!!!
%html{ lang: 'en' }
  %head
    %meta{ charset: 'utf-8' }/
    %meta{ content: 'IE=Edge,chrome=1', 'http-equiv' => 'X-UA-Compatible' }/
    %meta{ content: 'width=device-width, initial-scale=1.0', name: 'viewport' }/
    = csrf_meta_tags
    = stylesheet_link_tag 'application', media: 'all'
    = javascript_include_tag 'application'

  %body
    %nav.navbar.navbar-default
      .container-fluid
        .navbar-header
          %span.navbar-brand #{AppConfig.workshops_name}
        %p.navbar-text.navbar-right
          Links should go here
    .container-fluid
      .row
        .col-lg-12
          = yield

的Gemfile

source 'https://rubygems.org'

gem 'rails', '4.1.8'

gem 'pg'
gem 'draper'
gem 'decent_exposure'
gem 'decent_decoration'
gem 'devise'
gem 'simple_form', '~> 3.1.0rc'
gem 'bootstrap-sass'
gem 'haml-rails'
gem 'sass-rails', github: 'rails/sass-rails'
gem 'coffee-rails'
gem 'uglifier'
gem 'quiet_assets'
gem 'jquery-rails'
gem 'therubyracer', platforms: :ruby
gem 'travis'
gem 'ffaker'
gem 'faker'
gem 'konf'

group :development do
  gem 'spring'
end

group :development, :test do
  gem 'rspec-rails'
  gem 'factory_girl_rails'
  gem 'pry'
end

group :test do
  gem 'database_cleaner'
  gem 'shoulda-matchers', require: false
end

ruby '2.3.1'

资产/样式表/应用

/*
 *= require_tree .
 *= require_self
 */

资产/ Javascript角/应用

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

我不知道还有什么可以帮到你。有谁知道这里发生了什么?提前谢谢!

0 个答案:

没有答案