How do I safely delete an already created "User"?

Asked 2 years ago, Updated 2 years ago, 36 views

Twitter login is being implemented on Rubu on rails.
For that reason, I would like to create a user model for login.

I typed the following command to the terminal to create a user model.

./bin/railsg model user provider:string uid:string nickname:string image_url:string

The following error message was displayed:

Running via Spring preloader in process 66801
      invoke active_record
The name 'User' is either already used in your application or reserved by
Ruby on Rails. Please choose an alternative and run this generator again.

As far as the error message goes, "User" has already been used, but since I want to create a new model, how can I delete the existing "User" and create a new user model?

That's it

ruby-on-rails ruby

2022-09-30 19:56

1 Answers

I think what I want to do is add the necessary items to User.Rails has a mechanism called migration that allows you to add and remove columns from the database table.

rails migration AddDeviceColumnsToUsers provider:string uid:string nickname:string image_url:string

If so, the migration file will be created below db/migrate, so

rakedb:migrate

Please.

For more information on migration, see Rails Guides:Active Record Migration.


2022-09-30 19:56

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.