Ruby on Rails教程错误

时间:2016-03-09 21:05:10

标签: ruby-on-rails ruby ruby-on-rails-3 ruby-on-rails-3.2

我正在为博客做一个Rails教程,我收到2个错误。当您生成新网站以显示页面时,您需要在布局下将“应用程序”更改为“默认”。这工作正常,但我相信它正在创建一个新错误,它不会运行'destroy'.js操作。相反,当你去删除帖子时,它使用'get'方法,只链接到帖子页面(不删除它)。

以下是错误:(如果您发现它转到default.js)

ActionController::RoutingError (No route matches [GET] "/javascripts/default.js"
):
actionpack (4.2.5.1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in
`call'
web-console (2.3.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (2.3.0) lib/web_console/middleware.rb:18:in `catch'
web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
actionpack (4.2.5.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `
call'
railties (4.2.5.1) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.5.1) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.5.1) lib/active_support/tagged_logging.rb:68:in `block in t
agged'
activesupport (4.2.5.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.5.1) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.5.1) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.5.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'

rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.5.1) lib/active_support/cache/strategy/local_cache_middlewa
re.rb:28:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
actionpack (4.2.5.1) lib/action_dispatch/middleware/static.rb:116:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
railties (4.2.5.1) lib/rails/engine.rb:518:in `call'
railties (4.2.5.1) lib/rails/application.rb:165:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
c:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `servi
ce'
c:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
c:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/webrick/server.rb:294:in `block in
start_thread'


Rendered c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5
.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (2.0ms)
Rendered c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5
.1/lib/action_dispatch/middleware/templates/routes/_route.html.erb (2.0ms)
Rendered c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5
.1/lib/action_dispatch/middleware/templates/routes/_table.html.erb (2.0ms)
Rendered c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5
.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.e
rb (1.0ms)
Rendered c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5
.1/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb withi
n rescues/layout (1341.0ms)
Rendered c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/web-console-2.3.
0/lib/web_console/templates/_markup.html.erb (0.0ms)
Rendered c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/web-console-2.3.
0/lib/web_console/templates/_inner_console_markup.html.erb within layouts/inline
d_string (1.0ms)
Rendered c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/web-console-2.3.
0/lib/web_console/templates/_prompt_box_markup.html.erb within layouts/inlined_s
tring (1.0ms)
Rendered c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/web-console-2.3.
0/lib/web_console/templates/style.css.erb within layouts/inlined_string (0.0ms)
Rendered c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/web-console-2.3.
0/lib/web_console/templates/console.js.erb within layouts/javascript (922.0ms)
Rendered c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/web-console-2.3.
0/lib/web_console/templates/main.js.erb within layouts/javascript (0.0ms)
Rendered c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/web-console-2.3.
0/lib/web_console/templates/error_page.js.erb within layouts/javascript (1.0ms)
Rendered c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/web-console-2.3.
0/lib/web_console/templates/index.html.erb (2106.0ms)

我的问题是我不知道如何使用“应用程序”而不是“默认”来显示页面,如下所示:

<%= stylesheet_link_tag    'default', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'default', 'data-turbolinks-track' => true %>

或如何让js正确执行。

0 个答案:

没有答案