[Rails] "private method` String' called ~ "error when db: migrate

Introduction

I got the following error when migrating, so write it as a memorandum

== 20~~~~~~~~~~~ CreateBoards: migrating =====================================
-- create_table(:boards)
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

private method `String' called for 〜〜〜〜〜〜〜〜〜

Migration file

class CreateBoards < ActiveRecord::Migration[6.0]
  def change
    create_table :boards do |t|
      t.String :title
      t.String :text

      t.timestamps
    end
  end
end

Workaround

It seems to be useless if S of string is capitalized Correct to lowercase to resolve

class CreateBoards < ActiveRecord::Migration[6.0]
  def change
    create_table :boards do |t|
      t.string :title
      t.string :text

      t.timestamps
    end
  end
end

reference

https://stackoverflow.com/questions/4003651/ruby-on-rails-rake-dbmigrate-error/4003717

Recommended Posts

[Rails] "private method` String' called ~ "error when db: migrate
Error in rails db: migrate
PG :: DatatypeMismatch error when doing heroku run rails db: migrate
rails db: migrate failed!
Error with db: migrate: reset
Error when using rails capybara
About the error that occurred when adding the column name in rails (rails db: migrate, rails db: rollback, add)
[Rails] What to do when the error No database selected and Unknown database appears in db: migrate
[Rails] Modify migrate file (rails db: rollback)
[Rails] Modify migrate file (rails db: rollback STEP =)
Rails console Incorrect string value error handling
[heroku] run rails db: migrate doesn't work
private method
rails method
[Rails] Error resolution when generating tokens with PAYJP
[Rails] Solution when migration error occurs in acts-as-taggable-on
After all, what is [rails db: migrate] doing?
Rails <% = expression%> Why no error occurs when empty
[No Method Error] Solution when new action occurs
Rails error undefined method ʻimage_name'for nil: NilClass handling
Ruby on Rails Incorrect string value error resolution when posting a form in Japanese
Error in docker rails db: migrate (StandardError: An error has occurred, all later migrations canceled :)
[Rails] How to solve the error "undefined method` visit'" when using Capybara with Rspec
What to do when an error occurs in rails db: migrate ((StandardError: An error has occurred, this and all later migrations canceled :))
What to do when an error (StandardError: An error has occurred, this and all later migrations canceled:) appears in rails db: migrate