What is the command line syntax for generating a subclass model or scaffold in Rails?
rails g model Mysubclass my_field:string ....
How do I specify the parent class?
You can use "--parent=ParentClass".
Example:
1) Create a parent class "User".
rails g scaffold User login:string
2) Create a child class "Teacher".
rails g scaffold Teacher url:string --parent=User
But remember: you still need to create migrations(adding columns in datatables) and change views(adding fields in forms).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With