Skip to content

Possible improvements #35

@max-si-m

Description

@max-si-m

Hello, I've been recently integrated with your gem, and that is a wonderful piece of art. Helped me a lot, thank you. You did a great job.

I found some places that might be improved or changed according to my understanding:

  • Some models missed the dependent and inverse_of for associations.

  • No generator for models (needed for sharding and fixing associations).

  • No way to attach API routes without a dashboard, when the dashboard isn't required or forbidden.

  • Shouldn't the line 27 be moved to the 32? Is there a reason to generate stale pkpass?

    pass_output_path = Passkit::Generator.new(pass).generate_and_sign
    response.headers["last-modified"] = pass.last_update.httpdate
    if request.headers["If-Modified-Since"].nil? ||
    (pass.last_update.to_i > Time.zone.parse(request.headers["If-Modified-Since"]).to_i)
    send_file(pass_output_path, type: "application/vnd.apple.pkpass", disposition: "attachment")

  • I was curious what is the reason for having multiple passes per one generator? I mean when we have the same class for pass and generator. I've patched that to use find_or_create_by! but I'm wondering, maybe I'm missing something? Wouldn't it create a lot of redundant records?

    def create_pass(pass_class, generator = nil)
    pass = Passkit::Pass.create!(klass: pass_class, generator: generator)
    Passkit::Generator.new(pass).generate_and_sign

Maybe those findings would be helpful. If they are helpful somehow, I can help with some of them if needed.

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