Attach image to new user / Adjunar imagen a nuevo usuario

Hi,
I need to attach two images to the user registration form. What is the best method to do it? I have a local installation for testing purposes
Greetings

Hola,
necesito adjuntar dos imágenes en el formulario de registro de usuario. ¿Cuál es el mejor método para hacerlo? Tengo una instalación local con fines de prueba
Saludos

Hi elemibar,

Sorry for the delay in replying :pray:

I understand that you want to attach 2 images to the user who is registering. Is this the case?

To attach images we have the model concern Imageable that we include in the models that we want to attach an image. As you can see this concern has a :has_one relationship, so it is only prepared to attach a single image.

On the other hand, we have another model concern Documentable to relate different files to a model. In this case it is allowed to attach more than one file thanks to the :has_many relationship.

You can see examples of the use of these concerns in the models they contain:

include Documentable

or

include Imageable

I hope this information will be useful for you to move forward.

Best regards.


Hola elemibar,

Disculpa por la demora en la contesación :pray:

Entiendo que quieres adjuntar 2 imágenes al usuario que se está registrando. Eso es así?

Para adjuntar imágenes tenemos el concern de modelo Imageable que lo incluimos en los modelos que queremos adjuntar una imagen. Como verás este concern tiene una relación :has_one, así que solo está preparado para asociar una sola imagen.

En cambio tenemos otro concern de modelo Documentable para relacionar diferentes archivos con un modelo. En este caso si que se permite adjuntar más de un archivo gracias a la relación :has_many.

Puedes ver ejemplos de uso de estos concerns en los modelos que contengan:

include Documentable

o

include Imageable

Espero que esta información te sea útil para seguir avanzando.

Saludos.