Skip to content

Commit a7ba88b

Browse files
committed
Merge pull request #56001 from hachi8833/update_wishlists
[ci-skip][doc] Fix typos and errors in wishlists.md
1 parent 94b2e96 commit a7ba88b

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

guides/source/wishlists.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,10 @@ deleted, their wishlists are deleted too.
138138

139139
Then in `app/models/product.rb`, add:
140140

141-
```ruby#5-6
141+
```ruby#4-5
142142
class Product < ApplicationRecord
143143
include Notifications
144144
145-
has_many :subscribers, dependent: :destroy
146145
has_many :wishlist_products, dependent: :destroy
147146
has_many :wishlists, through: :wishlist_products
148147
has_one_attached :featured_image
@@ -159,7 +158,7 @@ SQL queries.
159158
We also set `wishlist_products` as `dependent: :destroy`. When a `Product` is
160159
destroyed, it will be automatically removed from any Wishlists.
161160

162-
A counter cache stores the number of associated records to avoid running a separate query each time the count is needed. So in `app/models/wishlist.rb`, let's update both associations to enable counter
161+
A counter cache stores the number of associated records to avoid running a separate query each time the count is needed. So in `app/models/wishlist_product.rb`, let's update both associations to enable counter
163162
caching:
164163

165164
```ruby#2-5
@@ -934,7 +933,7 @@ Lastly, add the link to the sidebar layout:
934933
<h4>Store Settings</h4>
935934
<%= link_to "Products", store_products_path %>
936935
<%= link_to "Users", store_users_path %>
937-
<%= link_to "Wishlists", store_products_path %>
936+
<%= link_to "Wishlists", store_wishlists_path %>
938937
<% end %>
939938
</nav>
940939
@@ -1118,7 +1117,7 @@ Let's create the index view next at
11181117
`app/views/store/subscribers/index.html.erb`:
11191118
11201119
```erb
1121-
<h1><%= pluralize "Subscriber", @subscribers.count %></h1>
1120+
<h1><%= pluralize @subscribers.count, "Subscriber" %></h1>
11221121
11231122
<%= form_with url: store_subscribers_path, method: :get do |form| %>
11241123
<%= form.collection_select :product_id, Product.all, :id, :name, selected: params[:product_id], include_blank: "All Products" %>
@@ -1164,7 +1163,7 @@ Finally, add the link to the sidebar layout:
11641163
<%= link_to "Products", store_products_path %>
11651164
<%= link_to "Users", store_users_path %>
11661165
<%= link_to "Subscribers", store_subscribers_path %>
1167-
<%= link_to "Wishlists", store_products_path %>
1166+
<%= link_to "Wishlists", store_wishlists_path %>
11681167
<% end %>
11691168
</nav>
11701169
@@ -1586,7 +1585,7 @@ should have no changes.
15861585
second_wishlist = user.wishlists.create!(name: "Second")
15871586
second_wishlist.wishlist_products.create(product_id: wishlist_product.product_id)
15881587
patch wishlist_wishlist_product_path(wishlist, wishlist_product), params: { new_wishlist_id: second_wishlist.id }
1589-
assert_equal "T-Shirt is already on Second Wishlist.", flash[:alert]
1588+
assert_equal "T-Shirt is already on Second.", flash[:alert]
15901589
assert_equal wishlist, wishlist_product.reload.wishlist
15911590
end
15921591
```

0 commit comments

Comments
 (0)