# Terminal bundle add hotwire-rails bin/rails webpacker:set up:stimulus bin/rails turbo:set up rails g scaffold merchandise title "value:decimal{8,2}"
# fashions/product.rb class Product < ApplicationRecord validates :title, presence: true, uniqueness: true finish
# merchandise/edit.html.erb <%= turbo_frame_tag 'product' do %> <h1>Modifying Product</h1> <%= render 'kind', product: @product %> <%= link_to 'Present', @product %> | <%= link_to 'Again', products_path %> <% finish %>
# merchandise/index.html.erb <%= turbo_frame_tag 'product' do %> <h1>Merchandise</h1> <desk class="desk"> <thead> <tr> <th>Title</th> <th>Value</th> <th colspan="3"></th> </tr> </thead> <tbody> <% @merchandise.every do |product| %> <tr> <td><%= product.title %></td> <td><%= product.value %></td> <td><%= link_to 'Present', product %></td> <td><%= link_to 'Edit', edit_product_path(product) %></td> <td><%= link_to 'Destroy', product, technique: :delete, information: { affirm: 'Are you positive?' } %></td> </tr> <% finish %> </tbody> </desk> <br> <%= link_to 'New Product', new_product_path %> <% finish %>
# merchandise/new.html.erb <%= turbo_frame_tag 'product' do %> <h1>New Product</h1> <%= render 'kind', product: @product %> <%= link_to 'Again', products_path %> <% finish %>
# merchandise/present.html.erb <%= turbo_frame_tag 'product' do %> <p id="discover"><%= discover %></p> <p> <sturdy>Title:</sturdy> <%= @product.title %> </p> <p> <sturdy>Value:</sturdy> <%= @product.value %> </p> <%= link_to 'Edit', edit_product_path(@product) %> | <%= link_to 'Again', products_path %> <% finish %>