Is there a way to remove a previously generated devise model? I had generated 2 models with devise: user
and student
. Now I'm having trouble with the 2 different login pages and their routes, so I decided to switch to a single table inheritance solution (following a suggestion here ).
So I want to keep the devise model user
and generate 2 models with rails g model ...
that inherit from the user model: teacher
and student
.
But since I already have a devise model named student I was wondering if I could somehow delete the existing model and corresponding db table, or if it was enough to simply delete these 2 lines from the model:
# app/assets/models/student.rb
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
I don't think devise offers a generator that would bring your model back to a previous version (similar to rails destroy migration ...
). Apart from removing the devise
method call from your model, you would need to get rid of the table itself (in a migration) and all the generated templates and controllers referring to the Student
model, just to keep things clean.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.