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

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

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

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 6

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

Ruby on Rails

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

Q&A

0回答

876閲覧

Puma caught this error: uninitialized constant ActionText::Engine::ApplicationController (NameError)

shomura1999

総合スコア0

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 6

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

Ruby on Rails

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

1グッド

1クリップ

投稿2021/12/07 08:55

開発環境

Gemfile

1source 'https://rubygems.org' 2git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 4ruby '2.6.5' 5 6# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 7gem 'rails', '~> 6.0.0' 8# Use mysql as the database for Active Record 9gem 'mysql2', '0.5.3' 10# Use Puma as the app server 11gem 'puma', '~> 3.11' 12# Use SCSS for stylesheets 13gem 'sass-rails', '~> 5' 14# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker 15gem 'webpacker', '~> 4.0' 16# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 17gem 'turbolinks', '~> 5' 18# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 19gem 'jbuilder', '~> 2.7' 20# Use Redis adapter to run Action Cable in production 21# gem 'redis', '~> 4.0' 22# Use Active Model has_secure_password 23# gem 'bcrypt', '~> 3.1.7' 24 25# Use Active Storage variant 26# gem 'image_processing', '~> 1.2' 27 28# Reduces boot times through caching; required in config/boot.rb 29gem 'bootsnap', '>= 1.4.2', require: false 30 31group :development, :test do 32 # Call 'byebug' anywhere in the code to stop execution and get a debugger console 33 gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 34end 35 36group :development do 37 # Access an interactive console on exception pages or by calling 'console' anywhere in the code. 38 gem 'web-console', '>= 3.3.0' 39 gem 'listen', '>= 3.0.5', '< 3.2' 40 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 41 gem 'spring' 42 gem 'spring-watcher-listen', '~> 2.0.0' 43end 44 45group :test do 46 # Adds support for Capybara system testing and selenium driver 47 gem 'capybara', '>= 2.15' 48 gem 'selenium-webdriver' 49 # Easy installation and use of web drivers to run system tests with browsers 50 gem 'webdrivers' 51end 52 53# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 54gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 55gem 'pry-rails' 56gem 'active_hash' 57gem 'devise' 58gem 'ransack' 59

前提・実現したいこと

・エラーを解決したい/元のエラー画面に戻したい
学生情報と企業情報を一覧で見れるサイトを作成しています。
作成するにあたり、localhost:3000にてindex.htmlの画面を表示したいのですが、表示形式がおかしいエラーになります。こちらの解決方法(パソコンを再起動し、再度ログインする)を試してみましたがエラーは変わらず表示されています。
イメージ説明

発生している問題・エラーメッセージ

Puma caught this error: uninitialized constant ActionText::Engine::ApplicationController (NameError) /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/actiontext-6.0.4.1/lib/action_text/engine.rb:47:in `block (2 levels) in <class:Engine>' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.4.1/lib/active_support/callbacks.rb:428:in `instance_exec' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.4.1/lib/active_support/callbacks.rb:428:in `block in make_lambda' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.4.1/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.4.1/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.4.1/lib/active_support/callbacks.rb:604:in `catch' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.4.1/lib/active_support/callbacks.rb:604:in `block in default_terminator' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.4.1/lib/active_support/callbacks.rb:201:in `block in halting' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.4.1/lib/active_support/callbacks.rb:513:in `block in invoke_before' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.4.1/lib/active_support/callbacks.rb:513:in `each' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.4.1/lib/active_support/callbacks.rb:513:in `invoke_before' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.4.1/lib/active_support/callbacks.rb:134:in `run_callbacks' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.4.1/lib/active_support/execution_wrapper.rb:119:in `complete!' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.4.1/lib/active_support/execution_wrapper.rb:76:in `ensure in block in run!' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.4.1/lib/active_support/execution_wrapper.rb:76:in `block in run!' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.4.1/lib/active_support/execution_wrapper.rb:70:in `tap' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.4.1/lib/active_support/execution_wrapper.rb:70:in `run!' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/actionpack-6.0.4.1/lib/action_dispatch/middleware/executor.rb:12:in `call' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/actionpack-6.0.4.1/lib/action_dispatch/middleware/static.rb:126:in `call' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/sendfile.rb:110:in `call' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/actionpack-6.0.4.1/lib/action_dispatch/middleware/host_authorization.rb:82:in `call' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/webpacker-4.3.0/lib/webpacker/dev_server_proxy.rb:23:in `perform_request' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rack-proxy-0.7.0/lib/rack/proxy.rb:63:in `call' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.4.1/lib/rails/engine.rb:527:in `call' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/puma-3.12.6/lib/puma/configuration.rb:227:in `call' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/puma-3.12.6/lib/puma/server.rb:706:in `handle_request' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/puma-3.12.6/lib/puma/server.rb:476:in `process_client' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/puma-3.12.6/lib/puma/server.rb:334:in `block in run' /Users/muramatsusho/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/puma-3.12.6/lib/puma/thread_pool.rb:135:in `block in spawn_thread'

該当のソースコード

ruby

1routes.rb 2Rails.application.routes.draw do 3 root to: 'student_users#index' 4 devise_for :student_users 5 resources :student_users do 6 collection do 7 get 'search' 8 end 9 end 10 devise_for :corp_users 11 resources :corp_users, only: [:show, :index] do 12 collection do 13 get 'search' 14 end 15 end 16end

ruby

1application_record.rb 2 3class ApplicationRecord < ActiveRecord::Base 4 self.abstract_class = true 5end

ruby

1corp_users_controller.rb(企業側コントローラー) 2 3class CorpUsersController < ApplicationController 4 before_action :search_corp, only: [:index, :search] 5 before_action :move_to_index, except: [:index, :search] 6 7 8 def index 9 @corp_user = CorpUser.all.order("created_at DESC") 10 end 11 12 def show 13 @corp_user = CorpUser.find(params[:id]) 14 end 15 16 def search 17 @results = @p.result 18 end 19 20 private 21 def search_corp 22 @p = CorpUser.ransack(params[:q]) 23 end 24 25 def move_to_index 26 unless student_user_signed_in? || corp_user_signed_in? 27 redirect_to action: :index 28 flash[:alert] = "ログイン/新規登録をして下さい" 29 end 30 end 31end 32

ruby

1student_users_controller(学生側コントローラー) 2 3class StudentUsersController < ApplicationController 4 before_action :set_student, only: [:edit, :show] 5 before_action :move_to_index, except: [:index, :search] 6 before_action :search_student, only: [:index, :search] 7 8 def index 9 @students = StudentUser.order("created_at DESC") 10 end 11 12 def new 13 @student = StudentUser.new 14 end 15 16 def create 17 StudentUser.create(student_params) 18 end 19 20 def show 21 @student = current_student_user 22 end 23 24 def edit 25 end 26 27 def update 28 student = StudentUser.find(params[:id]) 29 student.update(student_params) 30 end 31 32 def destroy 33 student = StudentUser.find(params[:id]) 34 student.destroy 35 end 36 37 def search 38 @results = @p.result 39 end 40 41 private 42 def student_params 43 params.require(:student).permit(:name, :college_name, :gakubu_name, :gakka_name, :one_word, :exp_occ, :circle_name, :qual_name, 44 :intern_history_id, :graduation_id, :prefecture_id, :industry_id, :gender_id, :grade_id, :sales_amount) 45 end 46 47 def set_student 48 @student = StudentUser.find(params[:id]) 49 end 50 51 def move_to_index 52 unless student_user_signed_in? || corp_user_signed_in? 53 redirect_to action: :index 54 flash[:alert] = "ログイン/新規登録をして下さい" 55 end 56 end 57 58 def search_student 59 @p = StudentUser.ransack(params[:q]) 60 end 61end 62

試したこと

・コードを動いていた時のコードまで戻した
・ 前提・実現で書かれた解決方法を試した

補足情報(FW/ツールのバージョンなど)

初めはルーティングエラーになっていまして、こちらの記事を参考にapplication_record.rbを変更した後にこちらのエラー表示になりました。(コードを戻してもエラーになります)

shinoharat👍を押しています

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

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

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

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

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

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

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

ただいまの回答率
85.46%

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

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

質問する

関連した質問