Skip to content

Extending Models #22

@johannesschobel

Description

@johannesschobel

Dear @a-chacon ,

thanks again for this project - great work.
I was stumbling upon an issue, where i want to extend the models you already provide. In particular, the Url model. I want to add an additional qrcode attribute via ActiveStorage with

has_one_attached :qrcode

How can i achieve the latter in the best / rails way?
I see 2 options:

  1. extend your class with class UrlWithQRCode < RailsUrlShortener::Url and add functionality there
  2. we could add a generator (i.e., rails g urlshortener:install) that basically copies (!) all your models / controllers / ... to respective directories within app (i.e., like devise would do it). This way, the developer can easily customize / adjust everything.

What do you think?
All the best,
Johannes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions