Sha256: 4818936ff23ba8e65018b104a0d1eb88afb9806d0ce20b250d3cbbd8ef229437
Contents?: true
Size: 970 Bytes
Versions: 2
Compression:
Stored size: 970 Bytes
Contents
class Admin::ShippingOptionsController < Admin::BaseController def edit @shipping_methods = ShippingMethod.all @supplier = Supplier.find(params[:id]) end def create @supplier = Supplier.find(params[:supplier_id]) if !params[:shipping_options].nil? method = ShippingMethod.find_by_id(params[:shipping_options]) @update = true @supplier.shipping_methods.each do |t| if t.id == method.id @update = false end end if @update == true @supplier.shipping_methods << method flash[:notice] = "New shipping method added successfully." else flash[:error] = "You already offer this shipping method, nothing added." end elsif !params[:remove].nil? method = ShippingMethod.find_by_id(params[:remove][:id]) @supplier.shipping_methods.delete(method) flash[:notice] = "Shipping method removed successfully" end redirect_to :back end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spree_suppliers-0.0.1 | app/controllers/admin/shipping_options_controller.rb |
spree_suppliers-0.60.3 | app/controllers/admin/shipping_options_controller.rb |