I have a json column inside my database, it contains only one object so I’m using embeds_one in my schema. i also have a form as part of the template but I don’t know how to access the fields to create/edit this object.
<%= for song <- @album.cover_song do %> <div class=""> <%= label song, :title %> <%= text_input song, :title %> <%= error_tag song, :title %> </div> <% end %>
With this code I’m getting " protocol Enumerable not implemented…" error which is understandable as there is only one map here and it will always be just one, this code works fine with embeds_many when there are multiple maps inside the list.
So, how do I access those fields in my template when there is just one embedded map?