You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/source/wishlists.md
+6-7Lines changed: 6 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -138,11 +138,10 @@ deleted, their wishlists are deleted too.
138
138
139
139
Then in `app/models/product.rb`, add:
140
140
141
-
```ruby#5-6
141
+
```ruby#4-5
142
142
class Product < ApplicationRecord
143
143
include Notifications
144
144
145
-
has_many :subscribers, dependent: :destroy
146
145
has_many :wishlist_products, dependent: :destroy
147
146
has_many :wishlists, through: :wishlist_products
148
147
has_one_attached :featured_image
@@ -159,7 +158,7 @@ SQL queries.
159
158
We also set `wishlist_products` as `dependent: :destroy`. When a `Product` is
160
159
destroyed, it will be automatically removed from any Wishlists.
161
160
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
163
162
caching:
164
163
165
164
```ruby#2-5
@@ -934,7 +933,7 @@ Lastly, add the link to the sidebar layout:
934
933
<h4>Store Settings</h4>
935
934
<%= link_to "Products", store_products_path %>
936
935
<%= link_to "Users", store_users_path %>
937
-
<%= link_to "Wishlists", store_products_path %>
936
+
<%= link_to "Wishlists", store_wishlists_path %>
938
937
<% end %>
939
938
</nav>
940
939
@@ -1118,7 +1117,7 @@ Let's create the index view next at
0 commit comments