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

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

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

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

Q&A

解決済

1回答

971閲覧

rails g controller usersrコマンドを入力してもusers_controllerが作成されません

kuroneko96

総合スコア16

Ruby on Rails

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

0グッド

0クリップ

投稿2019/03/13 14:03

実現したいこと

rails g controller usersrコマンドを入力時、
users_controllerを作成したいです。

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

usersコントローラが作成されない

kuronekonoMacBook-puro:crud_sample kuroneko$ rails g controller users /Users/kuroneko/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-2.0.1/lib/bundler/rubygems_integration.rb:408:in `block (2 levels) in replace_gem': Error loading the 'sqlite3' Active Record adapter. Missing a gem it depends on? can't activate sqlite3 (~> 1.3.6), already activated sqlite3-1.4.0. Make sure all dependencies are added to Gemfile. (LoadError)kuronekonoMacBook-puro:crud_sample kuroneko$

調べたこと

Gemファイルの中の記述がおかしい?ことまでは
わかったのですがどこをどう書き換えたらいいのか
困っています。

補足情報(ツールのバージョン)

Rails 5.2.2

Gemファイルの中身

source

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

どうかお力をお貸しください、
よろしくお願い致します。

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

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

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

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

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

guest

回答1

0

ベストアンサー

エラーメッセージ内にもある通り、SQLiteのバージョンを変更する必要があります。
Gemfile内の上部にある

Ruby

1gem 'sqlite3'

を、

Ruby

1gem 'sqlite3', '~> 1.3.6'

ように変更し、bundle install すると上手くいくと思われます。

投稿2019/03/13 14:29

Siroyan

総合スコア20

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

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

kuroneko96

2019/03/13 14:40

おっしゃる通り記述を変更し bundle install で userコントローラーが作成できました! ありがとうございました!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問