Giter Club home page Giter Club logo

Comments (4)

stavro avatar stavro commented on July 25, 2024 1

Sorry, try this:

book = Repo.get! Book, 1
book |> Ecto.Changeset.change(
  image: %{file_name: "tea_rex.jpeg", updated_at: Ecto.DateTime.utc}
) |> Repo.update!

from arc_ecto.

stavro avatar stavro commented on July 25, 2024

If you have an uploaded image on S3 which you want to reference directly, you should not use primary keys of the model to store the files, as these could change every time you seed. I would instead use a uuid as the filename / path.

Then, during the seed file, I would set the avatar attribute directly, rather than going through an upload process.

user = Repo.get! User, 1

user |> Ecto.Changeset.change(avatar: "ccfba165-aa01-4640-a2c7-a580a9a3bb4a.png?v=63620622730") |> Repo.update!

Did you find a different approach to take?

from arc_ecto.

keslert avatar keslert commented on July 25, 2024

@stavro No such luck. I've just been skipping images for now. I tried your suggestion but I'm stil getting the following errors: https://gist.github.com/keslert/c93e46def689e79ca8d5.

I tried inserting the book by itself and then doing the update and it gives the same error. This is my BookImage implementation: https://gist.github.com/keslert/445671bf256622319f84

from arc_ecto.

keslert avatar keslert commented on July 25, 2024

Awesome, that did it. Thanks!

from arc_ecto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.