1

我有一个基于 Michael Hartl 的 Rails 教程的 Ruby on Rails Web 应用程序。过去一周,我试图在我拥有的服务器上运行生产设置。当前设置包括 Ubuntu Server 12.04 LTS、RVM、Ruby 1.9.3、Rails 3.2.8、Apache2、MySQL 和Passenger。

我能够在网络上获取该应用程序,但它有一个错误。Ubuntu 机器在浏览器中显示错误(如下所示)。但是,除非我预编译我的资产,否则我的 Windows 7 开发机器上不存在该错误。我基于 twitter bootstrap-sass gem 的样式表资产似乎是罪魁祸首。如果我删除 custom.css.scss 的内容,应用程序加载没有错误,但显然没有样式。如果我只包含@import "bootstrap";custom.css.scss 文件中的语句仍然有错误。我还尝试了 gem bootstrap-rails 并遇到了同样的错误。如果您需要更多信息来回答问题,请告诉我。谢谢!

显示 /home/cdysert/railsprojects/testapp/app/views/layouts/application.html.erb 其中第 5 行提出:

参数数量错误(1 代表 0)(在 /home/cdysert/railsprojects/testapp/app/assets/stylesheets/custom.css.scss 中)

提取的源代码(第 5 行附近):

2: <html>
3:   <head>
4:     <title><%= full_title(yield(:title)) %></title>
5:     <%= stylesheet_link_tag "application", media: "all" %>
6:     <%= javascript_include_tag "application" %>
7:     <%= csrf_meta_tags %>
8:     <%= render 'layouts/shim' %>

自定义.css.scss

@import "bootstrap";

/* mixins, variables, etc. */

$grayMediumLight: #eaeaea;

@mixin box_sizing {
-moz-box-sizing: border-box; 
-webkit-box-sizing: border-box; 
box-sizing: border-box;
}

/* universal */

html {
overflow-y: scroll;
}

body {
padding-top: 60px;
}

section {
overflow: auto;
}

textarea {
resize: vertical;
}

.center {
text-align: center;
h1 {
margin-bottom: 10px;
}
}

/* typography */

h1, h2, h3, h4, h5, h6 {
line-height: 1;
}

h1 {
font-size: 3em;
letter-spacing: -2px;
margin-bottom: 30px;
text-align: center;
}

h2 {
font-size: 1.7em;
letter-spacing: -1px;
margin-bottom: 30px;
text-align: center;
font-weight: normal;
color: $grayLight;
}

p {
font-size: 1.1em;
line-height: 1.7em;
}

/* forms */

input, textarea, select, .uneditable-input {
border: 1px solid #bbb;
width: 100%;
padding: 10px;
height: auto;
margin-bottom: 15px;
@include box_sizing;
}

#error_explanation {
color: #f00;
ul {
list-style: none;
margin: 0 0 18px 0;
}
}

.field_with_errors {
@extend .control-group;
@extend .error;
}

/* header */

#logo {
float: left;
margin-right: 10px;
font-size: 1.7em;
color: white;
text-transform: uppercase;
letter-spacing: -1px;
padding-top: 9px;
font-weight: bold;
line-height: 1;
&:hover {
color: white;
text-decoration: none;
}
}

/* footer */

footer {
margin-top: 45px;
padding-top: 5px;
border-top: 1px solid $grayMediumLight;
color: $grayLight;
a {
color: $gray;
&:hover { 
color: $grayDarker;
}
}  
small { 
float: left; 
}
ul {
float: right;
list-style: none;
li {
float: left;
margin-left: 10px;
}
}
}

/* sidebar */

aside {
section {
padding: 10px 0;
border-top: 1px solid $grayLighter;
&:first-child {
border: 0;
padding-top: 0;
}
span {
display: block;
margin-bottom: 3px;
line-height: 1;
}
h1 {
font-size: 1.6em;
text-align: left;
letter-spacing: -1px;
margin-bottom: 3px;
}
}
}

.gravatar {
float: left;
margin-right: 10px;
}

.stats {
overflow: auto;
a {
float: left;
padding: 0 10px;
border-left: 1px solid $grayLighter;
color: gray;
&:first-child {
padding-left: 0;
border: 0;
}
&:hover {
text-decoration: none;
color: $blue;
}
}
strong {
display: block;
}
}

.user_avatars {
overflow: auto;
margin-top: 10px;
.gravatar {
margin: 1px 1px;
}
}


/* users index */

.users {
list-style: none;
margin: 0;
li {
overflow: auto;
padding: 10px 0;
border-top: 1px solid $grayLighter;
&:last-child {
border-bottom: 1px solid $grayLighter;
}
}
}

/* microposts */

.microposts {
list-style: none;
margin: 10px 0 0 0;

li {
padding: 10px 0;
border-top: 1px solid #e8e8e8;
}
}
.content {
display: block;
}
.timestamp {
color: $grayLight;
}
.gravatar {
float: left;
margin-right: 10px;
}
aside {
textarea {
height: 100px;
margin-bottom: 5px;
}
}

/* miscellaneous */

.debug_dump {
clear: both;
float: left;
width: 100%;
margin-top: 45px;
@include box_sizing;
}

宝石文件

source 'https://rubygems.org'

gem 'rails', '3.2.8'
gem 'bootstrap-sass', '2.0.4'
gem 'bcrypt-ruby', '3.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
gem 'jquery-rails', '2.0.2'
gem 'mysql2', '0.3.11'
gem 'vincenty', '1.0.3'

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

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '3.2.5'
  gem 'coffee-rails', '3.2.2'
  gem 'uglifier', '1.2.3'
  gem 'therubyracer', '0.10.2'
end

group :test do
  gem 'capybara', '1.1.2'
end
4

0 回答 0