Class: Admin::CatalogProductVideosController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::CatalogProductVideosController
- Defined in:
- app/controllers/workarea/admin/catalog_product_videos_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/workarea/admin/catalog_product_videos_controller.rb', line 12 def create @video = @product.videos.build(params[:video]) if @video.save flash[:success] = t("workarea.admin.catalog_product_videos.flash_messages.created") redirect_to catalog_product_videos_path(@product) else render :index, status: :unprocessable_entity end end |
#destroy ⇒ Object
39 40 41 42 43 |
# File 'app/controllers/workarea/admin/catalog_product_videos_controller.rb', line 39 def destroy @product.videos.find(params[:id]).destroy flash[:success] = t("workarea.admin.catalog_product_videos.flash_messages.deleted") redirect_to catalog_product_videos_path(@product) end |
#edit ⇒ Object
23 24 25 |
# File 'app/controllers/workarea/admin/catalog_product_videos_controller.rb', line 23 def edit @video = @product.videos.find(params[:id]) end |
#index ⇒ Object
6 7 8 |
# File 'app/controllers/workarea/admin/catalog_product_videos_controller.rb', line 6 def index @videos = @product.videos end |
#new ⇒ Object
10 |
# File 'app/controllers/workarea/admin/catalog_product_videos_controller.rb', line 10 def new; end |
#update ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/workarea/admin/catalog_product_videos_controller.rb', line 27 def update @video = @product.videos.find(params[:id]) if @video.update_attributes(params[:video]) flash[:success] = t("workarea.admin.catalog_product_videos.flash_messages.updated") else flash[:error] = t("workarea.admin.catalog_product_videos.flash_messages.error") end redirect_to catalog_product_videos_path(@product) end |