Decorators allow you to add or modify behavior of Spree classes in your application.
Spree::Product
model, create a file called app/models/spree/product_decorator.rb
.
available?
in the Product model.
app/models/spree/product_decorator.rb
Video
associated to Spree::Product
. Let’s start with creating a database migration:
Spree::Product
:
ProductDecorator
in app/models/spree/product_decorator.rb
:
app/controllers/spree/products_controller_decorator.rb
:load_data before_action
.
:load_data
will use params[:id]
to lookup the product by its permalink.