Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Ruby on Rails加载CSS时出错_Css_Ruby On Rails - Fatal编程技术网

使用Ruby on Rails加载CSS时出错

使用Ruby on Rails加载CSS时出错,css,ruby-on-rails,Css,Ruby On Rails,我正在使用RubyonRails做我的第一个小测试项目,在尝试将css加载到我的页面时,我遇到了一个错误。 我的视图有一个小表单,用于在谷歌日历上保存事件,代码如下所示 <%= javascript_include_tag "application", "data-turbolinks-track" => true %> <div id="content"> <h1>SAVE AN EVENT</h1> <form acti

我正在使用RubyonRails做我的第一个小测试项目,在尝试将css加载到我的页面时,我遇到了一个错误。 我的视图有一个小表单,用于在谷歌日历上保存事件,代码如下所示

<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<div id="content">

  <h1>SAVE AN EVENT</h1>

  <form action="/google_calendar/create" method="post" onsubmit="return validate_dates()" >
    <fieldset>
      <label for="title">Title:</label><input type="text" name="title" id="title" class="textbox" />
      <label for="begindate">Begin Date:</label><input type="date" name="begindate" id="begindate" class="time" />
      <label for="beginhour">Begin Hour:</label><input type="time" name="beginhour"  id="beginhour" class="time" />
      <label for="enddate">End Date:</label><input type="date" name="enddate" id="enddate" class="time" />
      <label for="endhour">End Hour:</label><input type="time" name="endhour" id="endhour" class="time" />
      <label for="location">Location:</label><input type="text" name="location" id="location" class="textbox" size="31" class="textbox" />
      <label for="description">Description:</label><textarea rows="10" cols="25" name="description" id="description" class="textbox"></textarea>
      <input type="Submit" value="Save"  class="button"/>
    </fieldset>
  </form>
  <span id="result_message">
  <%= @result_message %>
  </span>
</div>
<!DOCTYPE html>
<html>
<head>
  <title>RubyOnRailsCalendar</title>
  <%= stylesheet_link_tag    'default', media: 'all', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'default', 'data-turbolinks-track' => true %>
  <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
  <%= csrf_meta_tags %>
</head>
<body>

<%= yield %>

</body>
</html>
问题是,当我试图访问表单时,会出现以下错误:

Showing C:/Sites/RubyOnRailsCalendar/app/views/welcome/index.html.erb where line #1 raised: 
TypeError: The object doesn't support this property or method (translated from my native language)
有人知道为什么会这样吗

编辑:我在application.html.erb中添加了以下行,但仍然失败

<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
true%>
完整的文件如下所示

<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<div id="content">

  <h1>SAVE AN EVENT</h1>

  <form action="/google_calendar/create" method="post" onsubmit="return validate_dates()" >
    <fieldset>
      <label for="title">Title:</label><input type="text" name="title" id="title" class="textbox" />
      <label for="begindate">Begin Date:</label><input type="date" name="begindate" id="begindate" class="time" />
      <label for="beginhour">Begin Hour:</label><input type="time" name="beginhour"  id="beginhour" class="time" />
      <label for="enddate">End Date:</label><input type="date" name="enddate" id="enddate" class="time" />
      <label for="endhour">End Hour:</label><input type="time" name="endhour" id="endhour" class="time" />
      <label for="location">Location:</label><input type="text" name="location" id="location" class="textbox" size="31" class="textbox" />
      <label for="description">Description:</label><textarea rows="10" cols="25" name="description" id="description" class="textbox"></textarea>
      <input type="Submit" value="Save"  class="button"/>
    </fieldset>
  </form>
  <span id="result_message">
  <%= @result_message %>
  </span>
</div>
<!DOCTYPE html>
<html>
<head>
  <title>RubyOnRailsCalendar</title>
  <%= stylesheet_link_tag    'default', media: 'all', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'default', 'data-turbolinks-track' => true %>
  <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
  <%= csrf_meta_tags %>
</head>
<body>

<%= yield %>

</body>
</html>

红宝石
正确%>
正确%>
正确%>
编辑:已添加文件

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'google_calendar', '~> 0.5.1'

gem 'openssl'
源代码'https://rubygems.org'
#捆绑边缘Rails:gem'Rails',github'Rails/Rails'
gem“轨道”,“4.2.6”
#使用sqlite3作为活动记录的数据库
gem'sqlite3'
#将SCS用于样式表
gem'sass-rails',“~>5.0”
#使用Uglifier作为JavaScript资产的压缩器
gem'uglifier','>=1.3.0'
#将CoffeeScript用于.coffee资产和视图
gem“咖啡轨”,“~>4.1.0”
#看https://github.com/rails/execjs#readme 获取更多受支持的运行时
宝石“therubyracer”,平台::ruby
#使用jquery作为JavaScript库
gem'jqueryrails'
#Turbolinks使web应用程序中的以下链接更快。阅读更多:https://github.com/rails/turbolinks
gem“涡轮链接”
#轻松构建JSON API。阅读更多:https://github.com/rails/jbuilder
gem'jbuilder',“~>2.0”
#bundle exec rake doc:rails在doc/API下生成API。
gem'sdoc','~>0.4.0',组::doc
#使用ActiveModel具有\u安全\u密码
#gem'bcrypt',“~>3.1.7”
#使用Unicorn作为应用程序服务器
#宝石“独角兽”
#使用Capistrano进行部署
#gem“capistrano rails”,集团::开发
小组:开发,:测试
#在代码中的任意位置调用“byebug”以停止执行并获得调试器控制台
宝石“比伯”
结束
小组:发展怎么办
#在异常页面上或通过在视图中使用访问IRB控制台
gem“web控制台”,“~>2.0”
结束
#Windows不包括zoneinfo文件,因此捆绑tzinfo数据
gem'tzinfo data',平台:[:mingw,:mswin,:x64_mingw,:jruby]
gem‘谷歌日历’,“~>0.5.1”
gem‘openssl’

application.html.erb
中,您必须在下一个字符串中加载所有样式
true%>
我将其添加到文件中,但仍然失败。您是否在
资产/样式表中有
default.css
文件?没有。我只有application.css文件并将其导入视图中。只需删除
true%>