質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

5766閲覧

AbstractController::ActionNotFound

nnnn5

総合スコア18

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2019/07/16 22:34

編集2019/07/16 23:37

特定のページ(articles_controller/new)に行った時だけこのようなエラーがターミナルに出ます。
ですが、このページでのCRUD操作は可能です。
モヤモヤしてます。。
かなり調べたのですが解法がいまいち分からず。。ご教授お願いいたします!(T ^ T)
特定のページだけっていうのと

bundlerのversionは2.0.2でした。
bundle installもbundle updateも問題なしです。

AbstractControllerというコントローラは作っていません。

ruby

1 2AbstractController::ActionNotFound (The action 'routing_error' could not be found for ApplicationController): 3 4vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.3/lib/abstract_controller/base.rb:129:in `process' 5vendor/bundle/ruby/2.5.0/gems/actionview-5.2.3/lib/action_view/rendering.rb:32:in `process' 6vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.3/lib/action_controller/metal.rb:191:in `dispatch' 7vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.3/lib/action_controller/metal.rb:252:in `dispatch' 8vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:52:in `dispatch' 9vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:34:in `serve' 10vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.3/lib/action_dispatch/journey/router.rb:52:in `block in serve' 11vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.3/lib/action_dispatch/journey/router.rb:35:in `each' 12vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.3/lib/action_dispatch/journey/router.rb:35:in `serve' 13vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:840:in `call' 14vendor/bundle/ruby/2.5.0/gems/warden-1.2.8/lib/warden/manager.rb:36:in `block in call' 15

gemfile

1 2source 'https://rubygems.org' 3git_source(:github) { |repo| "https://github.com/#{repo}.git" } 4 5ruby '2.5.1' 6 7# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 8gem 'rails', '~> 5.2.2' 9# Use mysql as the database for Active Record 10gem 'mysql2', '>= 0.4.4', '< 0.6.0' 11# Use Puma as the app server 12gem 'puma', '~> 3.11' 13# Use SCSS for stylesheets 14gem 'sass-rails', '~> 5.0' 15# Use Uglifier as compressor for JavaScript assets 16gem 'uglifier', '>= 1.3.0' 17# See https://github.com/rails/execjs#readme for more supported runtimes 18# gem 'mini_racer', platforms: :ruby 19 20# Use CoffeeScript for .coffee assets and views 21gem 'coffee-rails', '~> 4.2' 22# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 23gem 'turbolinks', '~> 5' 24# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 25gem 'jbuilder', '~> 2.5' 26# Use Redis adapter to run Action Cable in production 27# gem 'redis', '~> 4.0' 28# Use ActiveModel has_secure_password 29# gem 'bcrypt', '~> 3.1.7' 30 31# Use ActiveStorage variant 32# gem 'mini_magick', '~> 4.8' 33 34# Use Capistrano for deployment 35# gem 'capistrano-rails', group: :development 36 37# Reduces boot times through caching; required in config/boot.rb 38gem 'bootsnap', '>= 1.1.0', require: false 39 40group :development, :test do 41 # Call 'byebug' anywhere in the code to stop execution and get a debugger console 42 gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 43 gem 'pry-rails' 44 gem 'pry-byebug' 45 gem 'pry-doc' 46end 47 48group :development do 49 # Access an interactive console on exception pages or by calling 'console' anywhere in the code. 50 gem 'web-console', '>= 3.3.0' 51 gem 'listen', '>= 3.0.5', '< 3.2' 52 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 53 gem 'spring' 54 gem 'spring-watcher-listen', '~> 2.0.0' 55 gem 'letter_opener' 56 gem 'letter_opener_web' 57end 58 59group :test do 60 # Adds support for Capybara system testing and selenium driver 61 gem 'capybara', '>= 2.15' 62 gem 'selenium-webdriver' 63 # Easy installation and use of chromedriver to run system tests with Chrome 64 gem 'chromedriver-helper' 65end 66 67# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 68gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 69gem 'carrierwave' 70gem 'rmagick', '~> 3.0.0' 71gem 'kaminari' 72gem 'jquery-rails' 73gem 'jquery-ui-rails' 74gem 'devise' 75gem 'meta-tags' 76gem 'sitemap_generator' 77gem 'wysiwyg-rails' 78gem "font-awesome-rails" 79gem 'rinku' 80# gem 'ruby-oembed' 81gem 'jquery-oembed-rails', '~> 0.2.0' 82gem 'rails_12factor', group: :production 83gem 'fog-aws' 84# gem 'fog' 85

route

1 2 get '*not_found' => 'application#routing_error' 3 post '*not_found' => 'application#routing_error' 4 5この文を消したら今回のエラーは解決するけど新しいエラー 6`ActionController::RoutingError (No route matches [GET] "/assets/languages/ja.js.map"): 7`が発生 8

applicationcontroller

1class ApplicationController < ActionController::Base 2 before_action :set_current_user 3 4 protected 5 6 # 例外ハンドル 7 unless Rails.env.development? 8 # rescue_from Exception, with: :_render_500 9 rescue_from ActiveRecord::RecordNotFound, with: :_render_404 10 rescue_from ActionController::RoutingError, with: :_render_404 11 end 12 13 def routing_error 14 raise ActionController::RoutingError, params[:path] 15 end 16 17 private 18 19 def _render_404(e = nil) 20 logger.info "Rendering 404 with exception: #{e.message}" if e 21 22 if request.format.to_sym == :json 23 render json: { error: '404 error' }, status: :not_found 24 else 25 render template: "errors/error_404", status: :not_found, layout: 'application' 26 end 27 end 28 29 def _render_500(e = nil) 30 logger.error "Rendering 500 with exception: #{e.message}" if e 31 Airbrake.notify(e) if e # Airbrake/Errbitを使う場合はこちら 32 33 if request.format.to_sym == :json 34 render json: { error: '500 error' }, status: :internal_server_error 35 else 36 render template: "errors/error_500", status: :not_found, layout: 'application' 37 end 38 end 39 40end 41

articlescontroller

1 2class Admin::ArticlesController < ApplicationController 3 before_action :authenticate_user! 4 before_action :set_current_user 5 layout "admin" 6 7 def new 8 @article = Article.new 9 end 10 11 def create 12 @article = Article.new(article_params) 13 if @article.save 14 redirect_to admin_articles_path 15 else 16 render :new 17 end 18 end 19 20 private 21 22 def article_params 23 params.require(:article).permit(:title, :image, :status, :position, :introduction, :content 24) 25 end 26end 27
new.html.erb <div class = "admin"> <h2>記事作成</h2> <%= form_with model: [:admin, @article], local: true do |f| %> <table class="form_area"> <tr> <th scope="row">ステータス</th> <td><%= f.select :status, [['公開', true], ['非公開', false]] %></td> </tr> <tr> <th scope="row">メイン画像</th> <td><%= f.file_field :image %> <% if @article.image.present? %> <%= image_tag @article.image_url(:thumb).to_s %><br /> <%= f.hidden_field :image_cache %> <%= f.check_box :remove_image %><%= f.label :remove_image, '画像を削除する'%> <% end %> </td> </tr> <tr> <th scope="row">地域</th> <td> <%= collection_check_boxes(:article, :pref_ids, Pref.all, :id, :name) do |b| %> <%= b.label { b.check_box + b.text } %> <% end %> </td> </tr> <tr> <th scope="row">タイトル</th> <td><%= f.text_field :title , size: "90x10" %></td> <%= error_on(:article, :title)%> </tr> </table> <input id="submit" type="submit" alt="登録する" /> <% end %>

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

maisumakun

2019/07/16 23:15

その「特定のページ」のURLやコントローラー、ビューの内容はどのようなものでしょうか。
nnnn5

2019/07/16 23:38

追記しました!確認いただけると幸いです
guest

回答1

0

ベストアンサー

この文を消したら今回のエラーは解決するけど新しいエラー

ActionController::RoutingError (No route matches [GET] "/assets/languages/ja.js.map"):
が発生

こちらにあるように、/assets/languages/ja.js.mapという場所にアクセスしていて、それが見つからない、というエラーです。ビューの中身を確認するなどして、どこで/assets/languages/ja.js.mapにアクセスしようとしているのかを、まずは確認してみましょう。

なお、AbstractControllerはコントローラーの継承ツリーをさかのぼったところに存在するものです。

投稿2019/07/16 23:39

maisumakun

総合スコア145184

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問