Skip to content

Commit

Permalink
Avoid generating duplicate element IDs
Browse files Browse the repository at this point in the history
Closes #567.
  • Loading branch information
janko committed Feb 19, 2022
1 parent b5e41b7 commit b0f5624
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ allow users to upload files:

```erb
<%= form_for @photo do |f| %>
<%= f.hidden_field :image, value: @photo.cached_image_data %>
<%= f.hidden_field :image, value: @photo.cached_image_data, id: nil %>
<%= f.file_field :image %>
<%= f.submit %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion doc/carrierwave.md
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ Shrine.plugin :cached_attachment_data
```
```rb
form_for @photo do |f|
f.hidden_field :image, value: @photo.cached_image_data
f.hidden_field :image, value: @photo.cached_image_data, id: nil
f.file_field :image
end
```
Expand Down
2 changes: 1 addition & 1 deletion doc/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ validation errors and for potential [direct uploads].
<!--Rails form builder-->
```rb
form_for @photo do |f|
f.hidden_field :image, value: @photo.cached_image_data
f.hidden_field :image, value: @photo.cached_image_data, id: nil
f.file_field :image
f.submit
end
Expand Down
2 changes: 1 addition & 1 deletion doc/multiple_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ album/photos as well (they will be submitted under the
form_for @album, html: { enctype: "multipart/form-data" } do |f|
f.text_field :title
f.fields_for :photos do |p| # adds new `album[photos_attributes]` parameter
p.hidden_field :image, value: p.object.cached_image_data
p.hidden_field :image, value: p.object.cached_image_data, id: nil
p.file_field :image
p.check_box :_destroy unless p.object.new_record?
end
Expand Down
6 changes: 3 additions & 3 deletions doc/refile.md
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ Shrine.plugin :cached_attachment_data
```
```rb
form_for @user do |form|
form.hidden_field :profile_image, value: @user.cached_profile_image_data
form.hidden_field :profile_image, value: @user.cached_profile_image_data, id: nil
form.file_field :profile_image
end
```
Expand All @@ -475,7 +475,7 @@ Shrine.plugin :remove_attachment
```
```rb
form_for @user do |form|
form.hidden_field :profile_image, value: @user.cached_profile_image_data
form.hidden_field :profile_image, value: @user.cached_profile_image_data, id: nil
form.file_field :profile_image
form.check_box :remove_profile_image
end
Expand All @@ -491,7 +491,7 @@ Shrine.plugin :remote_url
```
```rb
form_for @user do |form|
form.hidden_field :profile_image, value: @user.cached_profile_image_data
form.hidden_field :profile_image, value: @user.cached_profile_image_data, id: nil
form.file_field :profile_image
form.text_field :profile_image_remote_url
end
Expand Down
2 changes: 1 addition & 1 deletion doc/release_notes/2.1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ end

```rb
form_for @photo do |f|
f.hidden_field :image, value: @photo.cached_image_data
f.hidden_field :image, value: @photo.cached_image_data, id: nil
f.file_filed :image
end
```
Expand Down

0 comments on commit b0f5624

Please sign in to comment.