Components on Rails views
class Components::Products::Teaser < Matestack::Ui::Component
requires :product
def response
a path: product_path(context.product), class: 'product-teaser' do
div do
h2 context.product.name
paragraph conext.product.description
b context.product.price
end
end
end
end<%= @products.each do |product| %>
<%= Components::Products::Teaser.(product: product) %>
<% end %>Last updated
Was this helpful?