forked from spree-contrib/spree-multi-domain
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
There are no files selected for viewing
15 changes: 8 additions & 7 deletions
15
app/controllers/spree/admin/products_controller_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |