Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Igor Alexandrov
    @igor-alexandrov
    currently I create a small module that adds attachment macro
    module Shrine::Avram
      macro attachment(type_declaration)
        {% asset_name = type_declaration.var %}
    
        column {{ asset_name.id }}_data : JSON::Any
      end
    end
    and now I am somewhere in the middle of Operation integration
    Wout
    @wout
    Looks good. Do you think changes are required to Lucky for everything to work?
    Igor Alexandrov
    @igor-alexandrov
    To be honest – I don't know yet
    Wout
    @wout
    Ok :)
    Let's pick this up tomorrow once you pushed everything.
    Igor Alexandrov
    @igor-alexandrov
    Small question about forms: how to generate multipart: true form with form_for helper?
    I think, I've got it
    Wout
    @wout
    Probably something like: form_for Profile::Create, enctype: "multipart/form-data"?
    Igor Alexandrov
    @igor-alexandrov
    Yup, it works
    Wout
    @wout
    I'll create a PR for Lucky so we can do form_for Profile::Create, multipart: true, which is what most people would expect.
    Igor Alexandrov
    @igor-alexandrov
    But I have two problems with this:
    Wout
    @wout
    The first one is probably an easy fix. For the time being we can test with adding a regular param, but I'll tackle that.
    Igor Alexandrov
    @igor-alexandrov
    Maybe it is very easy to fix, but it is very annoying, since I cannot just upload an image now, I should add a Title or something else :)
    Wout
    @wout
    The second one is a bit harder to wrap my head around, but shouldn't that be needs instead of attribute? As in needs asset : Lucky::UploadedFile
    Maybe it is very easy to fix, but it is very annoying
    Absolutely!
    I'll try to fix it today, so we can maybe include it in the next release.
    Igor Alexandrov
    @igor-alexandrov

    I'll try to fix it today, so we can maybe include it in the next release.

    Great!

    What is the difference between needs and attributes?
    Wout
    @wout
    With needs, you define arguments for the initializer. I believe the only way right now to use files in operations is to pass them explicitly to the operation.
    Igor Alexandrov
    @igor-alexandrov
    Yes, I already got this. In Lucky room David pasted a link to Lucky extensions for the String.
    Wout
    @wout
    Great.
    Igor Alexandrov
    @igor-alexandrov
    My current idea is that we should add the same extensions to Shrine and this will give us an ability to do the following:
    class SaveImage < Image::SaveOperation
      param_key :image
    
      attribute asset : ImageUploader::Attachment
      attribute title : String
    end
    what do you think?
    Wout
    @wout
    Yes, that would be much better.
    Wout
    @wout
    @igor-alexandrov I've been looking at the issue you have with operations raising Lucky::MissingNestedParamError.
    Could it be you are calling the operation like this: SaveImage.create(params, upload)?
    Where params is empty and upload = params.nested_file?(:image)["file"]?
    Because the params are optional, so if you use SaveImage.create(upload), that should work without issues.
    Wout
    @wout
    I've opened an issue to document this: luckyframework/website#330
    Wout
    @wout
    The PR for multipart: true in form_for is waiting for approval: luckyframework/lucky#1200
    I'm now working on Avram to polish file uploads and I hop to get it finished this weekend.
    And I was also wondering, have you already done any work on implementing your Fastimage shard for the dimensions plugin? If not, I can take care of that as well if you want.
    Wout
    @wout
    Today I completed the majority of the work required for Avram to play more nicely with Shrine. You can see the WIP here: luckyframework/avram#396
    Hopefully we can ship this quickly. :)
    Igor Alexandrov
    @igor-alexandrov
    Hello
    I've been very busy last couple of days
    Will try to review everything starting from tomorrow
    Wout
    @wout
    No worries. It's not ready yet.
    Wout
    @wout
    So, I've finalized the PR: luckyframework/avram#404
    If that's merged, you'll be able to do this:
    class SaveImage < Image::SaveOperation
      param_key :image
    
      attribute asset : ImageUploader::Attachment
      attribute title : String
    end
    Given that ImageUploader::Attachment includes Avram::Uploadable.
    Wout
    @wout
    I'm now researching multi-file uploads.
    Igor Alexandrov
    @igor-alexandrov
    wow wow!
    great job, dude!
    Wout
    @wout
    Thanks :)
    Igor Alexandrov
    @igor-alexandrov
    I am still occupied with production work...
    Wout
    @wout
    No pressure. ;)