ruby on rails - How to add a new model (Video) to spree core associated with Product and its controller and a link to create it in Spree Admin layout -
i want add last link video spree admin panel under product. how go ahead , make feature.
i appreciate help.
thank you
you can create spree extension or use 1 of existing extensions. in extension's models/spree
directory create model file video.rb
.
module spree class video < activerecord::base #add active record associations #validations , model methods end end
you have decorate spree core
models affected new video model. example spree product
model. in extension's models/spree
directory create product model decorator product_decorator.rb
.
module spree product.class_eval #your video association product. e.g has_one :video end end
you can other spree core models associated video model.
in extension's controllers/spree/admin
you have create videos_controller.rb
. suggest take @ spree backend images_controller directions on how can add controller. if plan upload videos application, might need audio/video
transcoder such paperclip-av-transcoder.
you have deface spree/backend/app/views/spree/admin/products/new.html.erb
, spree/backend/app/views/spree/admin/products/edit.html.erb
add video addition , removal functionalities. not know structure , complexity of application , therefore not definite answer direction on how can achieve want.
`
Comments
Post a Comment