前提・実現したいこと
現在gemのcarrierwaveを作成中のアプリに導入したい為、gemをインストール後、rails generate migration add_image_to_posts image:stringでマイグレーションファイルを作成しようとしたのですがエラーが起きてしまいました。
このエラーを解決したい為、御助力頂きたいです。
発生している問題・エラーメッセージ
Running via Spring preloader in process 5367 invoke active_record Traceback (most recent call last): 41: from -e:1:in `<main>' 40: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' 39: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' 38: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load' 37: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load' 36: from /Users/uedatsuyoshi/my_projects/fassion_share_app/bin/rails:9:in `<main>' 35: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require' 34: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' 33: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' 32: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' 31: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' 30: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' 29: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.4/lib/rails/commands.rb:18:in `<main>' 28: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.4/lib/rails/command.rb:46:in `invoke' 27: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.4/lib/rails/command/base.rb:69:in `perform' 26: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch' 25: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command' 24: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run' 23: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.4/lib/rails/commands/generate/generate_command.rb:26:in `perform' 22: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.3.4/lib/rails/generators.rb:276:in `invoke' 21: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/base.rb:485:in `start' 20: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/group.rb:232:in `dispatch' 19: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:134:in `invoke_all' 18: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:134:in `map' 17: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:134:in `each' 16: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:134:in `block in invoke_all' 15: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command' 14: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run' 13: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/group.rb:134:in `_invoke_from_option_orm' 12: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/group.rb:266:in `_invoke_for_class_method' 11: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/shell.rb:68:in `with_padding' 10: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/group.rb:277:in `block in _invoke_for_class_method' 9: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:116:in `invoke' 8: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/group.rb:232:in `dispatch' 7: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:134:in `invoke_all' 6: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:134:in `map' 5: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:134:in `each' 4: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:134:in `block in invoke_all' 3: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command' 2: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run' 1: from /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activerecord-6.0.3.4/lib/rails/generators/active_record/migration/migration_generator.rb:15:in `create_migration_file' /Users/uedatsuyoshi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activerecord-6.0.3.4/lib/rails/generators/active_record/migration/migration_generator.rb:66:in `validate_file_name!': (ActiveRecord::IllegalMigrationNameError) Illegal name for migration file: add_image_to_posts image:string (only lower case letters, numbers, and '_' allowed).
該当のソースコード
gemfile
1# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 2gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 3gem 'pry-rails' 4gem 'haml-rails' 5gem 'devise' 6gem 'carrierwave'
試したこと
-
マイグレーションファイルの名前をアッパーキャメルケースに変えてみました。
-
bundleinstallをやり直してみました。
-
カラム名をimageからimgに変更して試してみました。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/12/07 15:09