Skip to content

Conversation

@swunderlich
Copy link

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 %>

Sönke Buhr added 2 commits April 2, 2015 00:45
Had a scenario where I was updating localized fields in a mongodb. The
autocreated id was not unique which leaded to failing (ambigous) tests.
Describing new feature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant