小编Pal*_*rma的帖子

rails app'ininitialized constant HomeController'中的路由错误

我是使用基础的新手,我使用脚手架创建了简单的帖子应用程序,我已经完成了以下步骤:

rails new blog
Run Code Online (Sandbox Code Playgroud)

然后在Gemfile中添加了以下内容

gem 'foundation-rails'
group :development do
  gem 'rails_layout'
end
Run Code Online (Sandbox Code Playgroud)

然后

$ bundle install
$ rails generate layout:install foundation5 --force
$ rails g scaffold Post title desc:text
$ rake db:migrate
Run Code Online (Sandbox Code Playgroud)

现在app运行良好@本地主机端口3000 /帖子 在此输入图像描述 但是当我点击导航栏中的"主页"按钮时,它会产生错误: 在此输入图像描述

application.html.erb文件:

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><%= content_for?(:title) ? yield(:title) : "Found Rails" %></title>
    <meta name="description" content="<%= content_for?(:description) ? yield(:description) : "Found Rails" %>">
    <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
    <%# Modernizr is required for Zurb Foundation %> …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails rails-routing zurb-foundation

5
推荐指数
1
解决办法
1万
查看次数

安装eventmachine gem时出错

当我运行时,foreman start我得到以下错误:

pallav@pallav-System-Product-Name:~/Workspace/Aadvisor$ foreman start
10:04:32 web.1  | started with pid 11022 10:04:32 web.1  |
/var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/spec_set.rb:92:in
`block in materialize': Could not find eventmachine-0.12.10 in any of
the sources (Bundler::GemNotFound) 10:04:32 web.1  |  from
/var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in
`map!' 10:04:32 web.1  |  from
/var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in
`materialize' 10:04:32 web.1  |   from
/var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in
`specs' 10:04:32 web.1  |   from
/var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/definition.rb:159:in
`specs_for' 10:04:32 web.1  |   from
/var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/definition.rb:148:in
`requested_specs' 10:04:32 web.1  |   from
/var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/environment.rb:18:in
`requested_specs' 10:04:32 web.1  |   from
/var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:13:in
`setup' 10:04:32 web.1  |   from
/var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:120:in `setup'
10:04:32 …
Run Code Online (Sandbox Code Playgroud)

ruby gem rubygems ruby-on-rails ruby-on-rails-3

3
推荐指数
1
解决办法
9559
查看次数

Bootstrap Rails 4 sass布局无法正常工作

我正在使用以下内容:

Rails 4.1.0

ruby 2.1.1p76(2014-02-24修订版45161)[x86_64-linux]

rvm 1.25.25(稳定)作者:Wayne E. Seguin,Michal Papis [ https://rvm.io/]

我的Gemfile:

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
gem 'bootstrap-sass-extras'


# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes …
Run Code Online (Sandbox Code Playgroud)

sass ruby-on-rails-4 twitter-bootstrap-3

3
推荐指数
1
解决办法
3512
查看次数

无法启动Rails服务器 - 无法找到JavaScript运行时

pallav@pallav-System-Product-Name:~/Workspace/blog$ rails server

/home/pallav/.rvm/gems/ruby-2.0.0-p353/gems/execjs-2.0.2/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
  from /home/pallav/.rvm/gems/ruby-2.0.0-p353/gems/execjs-2.0.2/lib/execjs.rb:5:in `<module:ExecJS>'
  from /home/pallav/.rvm/gems/ruby-2.0.0-p353/gems/execjs-2.0.2/lib/execjs.rb:4:in `<top (required)>'
  from /home/pallav/.rvm/gems/ruby-2.0.0-p353/gems/uglifier-2.4.0/lib/uglifier.rb:3:in `require'
  from /home/pallav/.rvm/gems/ruby-2.0.0-p353/gems/uglifier-2.4.0/lib/uglifier.rb:3:in `<top (required)>'
  from /home/pallav/.rvm/gems/ruby-2.0.0-p353/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `require'
  from /home/pallav/.rvm/gems/ruby-2.0.0-p353/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
  from /home/pallav/.rvm/gems/ruby-2.0.0-p353/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `each'
  from /home/pallav/.rvm/gems/ruby-2.0.0-p353/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `block in require'
  from /home/pallav/.rvm/gems/ruby-2.0.0-p353/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `each'
  from /home/pallav/.rvm/gems/ruby-2.0.0-p353/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `require'
  from /home/pallav/.rvm/gems/ruby-2.0.0-p353/gems/bundler-1.5.2/lib/bundler.rb:131:in `require'
  from /home/pallav/Workspace/blog/config/application.rb:7:in `<top (required)>'
  from /home/pallav/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.2/lib/rails/commands.rb:74:in `require'
  from /home/pallav/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.2/lib/rails/commands.rb:74:in `block in <top (required)>'
  from /home/pallav/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
  from /home/pallav/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails

2
推荐指数
2
解决办法
8402
查看次数

EOF警告:多字符字符常量[-Wmultichar]

#include <stdio.h>
int main(void)
{
  int c, blank, tab, lines;
  int till = 0;
  blank = tab = lines = 0;
  while(till == 0)
    {
      c = getchar();
      switch(c)
    {
    case ' ' :
      blank++;
    case '\t' :
      tab++;
    case '\n' :
      lines++;
    case 'EOF' : /* warning: multi-character character constant [-Wmultichar] */
      till = 1;
    }
    }
  printf("Blanks :%d Tab :%d Lines :%d\n", blank, tab, lines);
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

当我编译此代码时,它仍然存在以下错误:

警告:多字符字符常量[-Wmultichar]

我们如何在一个switch?中使用EOF ?

c

0
推荐指数
1
解决办法
5397
查看次数