gclement
gclement

Reputation: 93

Choose profile picture from Cloudinary

I would like to allow my users to choose a picture while they are signing-in. The thing is I don't want them to take a picture from their own computer. I would like them to choose pictures from a selection from Cloudinary.

Here is my first hypothesis :

I thought about creating a table, this table (name: Blason) could contain all my pictures. Add a line to my table user, blason_id. Then when my user sign-in, I add to the simple_form_for, f.select :blason_id ["urlcloudinary"]

Second hypothesis :

Directly through the sign-in form allow them to choose from my selection of pictures from cloudinary. But I don't know how to realize this and by the way if it's possible.

Thank you by advance.

Upvotes: 0

Views: 83

Answers (1)

Yanou
Yanou

Reputation: 1027

I would definitely create a Blason Model (and the associated table in the DB) with a user_id. I would seeds all the blasons and use an association input in my User creation simple_form_for:

<%= f.association :blason, collection: Blason.all.map { |blason| cl_image_tag blason.photo.key }, as: :radio_buttons %>

Upvotes: 1

Related Questions