Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an option for an "id_appendix" #468

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Added an option for an "id_appendix" #468

wants to merge 2 commits into from

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