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

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

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

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

Q&A

解決済

1回答

588閲覧

rails sでサーバー起動の際エラーが出ます

ru-rin

総合スコア10

Ruby on Rails

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

0グッド

0クリップ

投稿2022/06/21 06:56

学習を始めて3日目の新米です。
ページ推移の練習をしている際、rails sを起動すると、このようなエラーが出ました。
rail sを打つ前は、rails routesを何度か打ち、pathの前のコードを確認していました。
何度試しても、起動できず、次のステップに進めない為、大変困っています。
よろしくお願いいたします。

undefined local variable or method  ' for #<ActionDispatch::Routing::Mapper:0x00007fcf342ce650 @set=#<ActionDispatch::Routing::RouteSet:0x00007fcf36d3cd88>, @draw_paths=[#<Pathname:/Users/aml22l/Desktop/geektwitter/config/routes>], @scope=#<ActionDispatch::Routing::Mapper::Scope:0x00007fcf342ce5b0 @hash={:path_names=>{:new=>"new", :edit=>"edit"}}, @parent=#<ActionDispatch::Routing::Mapper::Scope:0x00007fcf34275de8 @hash=nil, @parent=nil, @scope_level=nil>, @scope_level=nil>, @concerns={}> (NameError) from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/actionpack-6.1.6/lib/action_dispatch/routing/route_set.rb:427:in instance_exec'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/actionpack-6.1.6/lib/action_dispatch/routing/route_set.rb:427:in eval_block' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/actionpack-6.1.6/lib/action_dispatch/routing/route_set.rb:409:in draw'
from /Users/aml22l/Desktop/geektwitter/config/routes.rb:1:in <main>' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in load'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in load' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/railties-6.1.6/lib/rails/application/routes_reloader.rb:47:in block in load_paths'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/railties-6.1.6/lib/rails/application/routes_reloader.rb:47:in each' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/railties-6.1.6/lib/rails/application/routes_reloader.rb:47:in load_paths'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/railties-6.1.6/lib/rails/application/routes_reloader.rb:21:in reload!' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/railties-6.1.6/lib/rails/application/routes_reloader.rb:35:in block in updater'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/activesupport-6.1.6/lib/active_support/file_update_checker.rb:83:in execute' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/railties-6.1.6/lib/rails/application/routes_reloader.rb:10:in execute'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/railties-6.1.6/lib/rails/application/finisher.rb:195:in block in <module:Finisher>' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/railties-6.1.6/lib/rails/initializable.rb:32:in instance_exec'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/railties-6.1.6/lib/rails/initializable.rb:32:in run' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/railties-6.1.6/lib/rails/initializable.rb:61:in block in run_initializers'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/3.0.0/tsort.rb:228:in block in tsort_each' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/3.0.0/tsort.rb:350:in block (2 levels) in each_strongly_connected_component'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/3.0.0/tsort.rb:431:in each_strongly_connected_component_from' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/3.0.0/tsort.rb:349:in block in each_strongly_connected_component'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/3.0.0/tsort.rb:347:in each' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/3.0.0/tsort.rb:347:in call'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/3.0.0/tsort.rb:347:in each_strongly_connected_component' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/3.0.0/tsort.rb:226:in tsort_each'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/3.0.0/tsort.rb:205:in tsort_each' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/railties-6.1.6/lib/rails/initializable.rb:60:in run_initializers'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/railties-6.1.6/lib/rails/application.rb:391:in initialize!' from /Users/aml22l/Desktop/geektwitter/config/environment.rb:5:in <main>'
from config.ru:3:in require_relative' from config.ru:3:in block in <main>'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/rack-2.2.3.1/lib/rack/builder.rb:116:in eval' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/rack-2.2.3.1/lib/rack/builder.rb:116:in new_from_string'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/rack-2.2.3.1/lib/rack/builder.rb:105:in load_file' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/rack-2.2.3.1/lib/rack/builder.rb:66:in parse_file'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/rack-2.2.3.1/lib/rack/server.rb:349:in build_app_and_options_from_config' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/rack-2.2.3.1/lib/rack/server.rb:249:in app'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/rack-2.2.3.1/lib/rack/server.rb:422:in wrapped_app' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/railties-6.1.6/lib/rails/commands/server/server_command.rb:77:in log_to_stdout'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/railties-6.1.6/lib/rails/commands/server/server_command.rb:37:in start' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/railties-6.1.6/lib/rails/commands/server/server_command.rb:144:in block in perform'
from internal:kernel:90:in tap' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/railties-6.1.6/lib/rails/commands/server/server_command.rb:135:in perform'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in run' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in invoke_command'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in dispatch' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/railties-6.1.6/lib/rails/command/base.rb:69:in perform'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/railties-6.1.6/lib/rails/command.rb:48:in invoke' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/railties-6.1.6/lib/rails/commands.rb:18:in <main>'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in require' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in require'
from /Users/aml22l/Desktop/geektwitter/bin/rails:5:in <top (required)>' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.0.0/lib/spring/client/rails.rb:30:in load'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.0.0/lib/spring/client/rails.rb:30:in call' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.0.0/lib/spring/client/command.rb:7:in call'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.0.0/lib/spring/client.rb:30:in run' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.0.0/bin/spring:49:in <top (required)>'
from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.0.0/lib/spring/binstub.rb:11:in load' from /Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/spring-4.0.0/lib/spring/binstub.rb:11:in <top (required)>'
from internal:/Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb:85:in require' from <internal:/Users/aml22l/.rbenv/versions/3.0.4/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in require'
from /Users/aml22l/Desktop/geektwitter/bin/spring:10:in block in <top (required)>' from <internal:kernel>:90:in tap'
from /Users/aml22l/Desktop/geektwitter/bin/spring:7:in <top (required)>' from bin/rails:2:in load'
from bin/rails:2:in `<main>'

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

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

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

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

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

guest

回答1

0

自己解決

route.erbを直すと、いけました!

投稿2022/06/21 08:30

ru-rin

総合スコア10

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.51%

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

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

質問する

関連した質問