Deployment was successful on heroku (when you enter the $heroku open command, the browser opens and the login screen created by the app is displayed normally), but you could not log in, so the database of the production environment (product environment) I have identified the cause to the point that the user information is not included in, but I am unable to set the initial user information in the database of the product environment.

, Seeds.rb has the following initial information.

User.create (name:'testuser', email:'[email protected]', admin: true, password:'test', password_confirmation:'test')

After that, if you enter the following command, an error will occur.

$rails db: seed RAILS_ENV = production
You have 1 pending migration:
  20201109134914 CreateActiveStorageTables
Run `rails db: migrate` to update your database then try again.
ChihironoMacBook-ea: taskleaf chihirokato $rails db: seed RAILS_ENV = production

It seems that the migration of a specific migrate file is stopped, but this error does not disappear even if I update the migration with rails db: migrate, or roll back and then migrate again.

I think that there is a lot of lack of knowledge about deployment because I just learned yesterday, but I would appreciate it if you could teach me.

  • Answer # 1

    If you want to register the initial information of heroku,heroku run rake db: seedIt will be.

Related articles