I am doing a Rails tutorial for a blog and I am getting 2 errors. When you generate the new site in order to have the pages show up you need to change 'application' to 'default' under the layout. That works fine but I believe it is creating a new error and it won't run the 'destroy' .js action. Instead, when you go to delete the post it uses a 'get' method and just links to the posts page (no deleting it).
Here is the error: (if you notice it goes to 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)
My problem is that I don't know how to either get the pages to show up using the 'application' instead of 'default' which looks like:
<%= stylesheet_link_tag 'default', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'default', 'data-turbolinks-track' => true %>
or how to get the js to execute correctly.
Aucun commentaire:
Enregistrer un commentaire