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

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

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

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

Ruby on Rails

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

Q&A

1回答

870閲覧

gemがきちんとインストールされているのかどうか教えてください。

ta1

総合スコア4

Ruby

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

Ruby on Rails

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

0グッド

1クリップ

投稿2020/01/02 02:33

前提・実現したいと

ログインと新規登録できるようにrails で作成しているのですが、
gem をインストール後、ルートが定義されていませんと出てしまいました。
どこが問題なのでしょうか?

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

エラーメッセージ undefined method `devise_for' for #<ActionDispatch::Routing::Mapper:0x00007fcb11fba4a8> config/routes.rb:2:in `block in <top (required)>' config/routes.rb:1:in `<top (required)>' This error occurred while loading the following files: /Users/tonystark/projects/or_blog/config/routes.rb

該当のソースコード

Rails.application.routes.draw do
devise_for :users
root to: 'posts#index'
resources :posts, except: :index

For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html

end

Ruby on rails

1ソースコード

試したこと

ここに問題に対して試したことを記載してください。
ターミナルでは、gemがインストールされていると思うのですが、
メソッドが定義されていないと出てしまいます。

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

※gem をインストールした時のターミナル結果です。

The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java.
Using rake 13.0.1
Using concurrent-ruby 1.1.5
Using i18n 1.7.0
Using minitest 5.13.0
Using thread_safe 0.3.6
Using tzinfo 1.2.6
Using activesupport 5.2.4.1
Using builder 3.2.4
Using erubi 1.9.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.7
Using rails-dom-testing 2.0.3
Using crass 1.0.5
Using loofah 2.4.0
Using rails-html-sanitizer 1.3.0
Using actionview 5.2.4.1
Using rack 2.0.8
Using rack-test 1.1.0
Using actionpack 5.2.4.1
Using nio4r 2.5.2
Using websocket-extensions 0.1.4
Using websocket-driver 0.7.1
Using actioncable 5.2.4.1
Using globalid 0.4.2
Using activejob 5.2.4.1
Using mini_mime 1.0.2
Using mail 2.7.1
Using actionmailer 5.2.4.1
Using activemodel 5.2.4.1
Using arel 9.0.0
Using activerecord 5.2.4.1
Using mimemagic 0.3.3
Using marcel 0.3.3
Using activestorage 5.2.4.1
Using public_suffix 4.0.2
Using addressable 2.7.0
Using io-like 0.3.0
Using archive-zip 0.12.0
Using bcrypt 3.1.13
Using bindex 0.8.1
Using msgpack 1.3.1
Using bootsnap 1.4.5
Using bundler 2.0.2
Using byebug 11.0.1
Using regexp_parser 1.6.0
Using xpath 3.2.0
Using capybara 3.30.0
Using childprocess 3.0.0
Using chromedriver-helper 2.1.1
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using coffee-script 2.4.1
Using method_source 0.9.2
Using thor 1.0.1
Using railties 5.2.4.1
Using coffee-rails 4.2.2
Using orm_adapter 0.5.0
Using responders 3.0.0
Using warden 1.2.8
Using devise 4.7.1
Using ffi 1.11.3
Using jbuilder 2.9.1
Using rb-fsevent 0.10.3
Using rb-inotify 0.10.1
Using ruby_dep 1.5.0
Using listen 3.1.5
Using mysql2 0.5.3
Using puma 3.12.2
Using sprockets 3.7.2
Using sprockets-rails 3.2.1
Using rails 5.2.4.1
Using rubyzip 2.0.0
Using sass-listen 4.0.0
Using sass 3.7.4
Using tilt 2.0.10
Using sass-rails 5.1.0
Using selenium-webdriver 3.142.7
Using spring 2.1.0
Using spring-watcher-listen 2.0.1
Using turbolinks-source 5.2.0
Using turbolinks 5.2.1
Using uglifier 4.2.0
Using web-console 3.7.0
Bundle complete! 19 Gemfile dependencies, 83 gems now installed.
Use bundle info [gemname] to see where a bundled gem is installed.
ここにより詳細な情報を記載してください。

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

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

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

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

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

guest

回答1

0

installされているかどうか調べる

--verboseオプションをつけて、 bundle install すると、どこにインストールされているのかを確認できると思います。

bundle install --verbose

ファイルがあればインストールされている、なければインストールされていないと思われます。

おそらく

状況を見るに、deviseの初期設定を行われていないのではないかなと推察しています。
rails generate devise:install を実行されていないようであれば、実行することで正常に動くようになるかもしれません。 (もしくはエラー内容が変わる)

投稿2020/01/02 04:56

tyamaguc07

総合スコア28

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

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

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

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問