Skip to content

Commit

Permalink
allow multiple taxons in product
Browse files Browse the repository at this point in the history
Allow to affect multiple taxons in product when using spree-multi-domain : see spree-contrib#148
  • Loading branch information
Arnaud Augier authored Sep 20, 2016
1 parent 91b218c commit e7eacad
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions app/controllers/spree/admin/products_controller_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
Spree::Admin::ProductsController.class_eval do
update.before :set_stores
before_action :find_stores, only: [:update]

def update
private

def set_stores
@product.store_ids = nil unless params[:product].key? :store_ids
end

def find_stores
store_ids = params[:product][:store_ids]
if store_ids.present?
params[:product][:store_ids] = store_ids.split(',')
end
super
end

private

def set_stores
@product.store_ids = nil unless params[:product].key? :store_ids
end
end

0 comments on commit e7eacad

Please sign in to comment.