Open swunderlich opened 9 years ago
I was (successfully) updating localized fields in a mongodb using mongoid. But my test failed due to ambiguous ids. The actual functionality uses a custom url. As I absolutely wanted to pass the test I added this little feature.
To get an idea of the actual code:
<% @product.descriptions.each do |desc| %> <div class="form-group"> <% I18n.available_locales.each do |locale| %> <% I18n.locale = locale %> <div class="input-group"> <span class="input-group-addon"><%= locale.to_s.upcase %></span> <%= best_in_place desc, :name, class: "form-control", url: "/set_desc/#{desc.id}/#{locale.to_s}", :id_appendix => locale %> </div> <% end %> </div> <% end %>
I was (successfully) updating localized fields in a mongodb using mongoid. But my test failed due to ambiguous ids. The actual functionality uses a custom url. As I absolutely wanted to pass the test I added this little feature.
To get an idea of the actual code: