Class: Spree::Admin::StoresController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Spree::Admin::StoresController
- Includes:
- Translatable
- Defined in:
- app/controllers/spree/admin/stores_controller.rb
Instance Method Summary collapse
Methods included from Translatable
Instance Method Details
#create ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/spree/admin/stores_controller.rb', line 15 def create @store = stores_scope.new(permitted_store_params) if @store.save flash[:success] = (@store, :successfully_created) redirect_to spree.admin_url(domain: @store.url), allow_other_host: true else flash[:error] = "#{Spree.t('store_errors.unable_to_create')}: #{@store.errors..join(', ')}" render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/spree/admin/stores_controller.rb', line 39 def destroy @store = stores_scope.find(params[:id]) if @store.destroy flash[:success] = (@store, :successfully_removed) redirect_to spree.admin_url(domain: Spree::Store.default.url), allow_other_host: true else render plain: "#{Spree.t('store_errors.unable_to_delete')}: #{@store.errors..join(', ')}", status: :unprocessable_entity end end |
#update ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/spree/admin/stores_controller.rb', line 27 def update @store.assign_attributes(permitted_store_params) if @store.save flash[:success] = (@store, :successfully_updated) else flash[:error] = "#{Spree.t('store_errors.unable_to_update')}: #{@store.errors..join(', ')}" end redirect_to spree.edit_admin_store_path(@store) end |