Skip to content
  • eileencodes's avatar
    261cbcd2
    Generate abstract class when generating scaffold in another database · 261cbcd2
    eileencodes authored
    
    
    This PR ensures that when you're generating a scaffold or model and that
    model should belong to another database it will create an abstract class
    if it doesn't already exist.
    
    The new abstract class will ensure that the new model inherits from that
    class, but will not be deleted if the scaffold is deleted. This is
    because Rails can't know if you have other models inheriting from that
    class so we don't want to revoke that if the scaffold is destroyed.
    
    If the abstract class already exists it won't be created twice. If the
    options for `parent` are set, the generator will use that as the
    abstract class instead of creating one. The generated abstract class
    will add the writing connection automatically, users need to add the
    reading connection themselves as Rails doesn't know which is the reading
    connection.
    
    Co-authored-by: default avatarJohn Crepezzi <john.crepezzi@gmail.com>
    261cbcd2
    Generate abstract class when generating scaffold in another database
    eileencodes authored
    
    
    This PR ensures that when you're generating a scaffold or model and that
    model should belong to another database it will create an abstract class
    if it doesn't already exist.
    
    The new abstract class will ensure that the new model inherits from that
    class, but will not be deleted if the scaffold is deleted. This is
    because Rails can't know if you have other models inheriting from that
    class so we don't want to revoke that if the scaffold is destroyed.
    
    If the abstract class already exists it won't be created twice. If the
    options for `parent` are set, the generator will use that as the
    abstract class instead of creating one. The generated abstract class
    will add the writing connection automatically, users need to add the
    reading connection themselves as Rails doesn't know which is the reading
    connection.
    
    Co-authored-by: default avatarJohn Crepezzi <john.crepezzi@gmail.com>
Loading