Class: Spree::Admin::SuppliersController
- Inherits:
-
ResourceController
- Object
- ResourceController
- Spree::Admin::SuppliersController
- Defined in:
- app/controllers/spree/admin/suppliers_controller.rb
Instance Method Summary collapse
Instance Method Details
#edit ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/controllers/spree/admin/suppliers_controller.rb', line 25 def edit @object.address = Spree::Address.build_default unless @object.address.present? respond_with(@object) do |format| format.html { render :layout => !request.xhr? } format.js { render :layout => false } end end |
#new ⇒ Object
33 34 35 |
# File 'app/controllers/spree/admin/suppliers_controller.rb', line 33 def new @object.address = Spree::Address.build_default end |
#update ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/spree/admin/suppliers_controller.rb', line 3 def update @object.address = Spree::Address.immutable_merge(@object.address, permitted_resource_params[:address_attributes]) if @object.update_attributes(permitted_resource_params.except(:address_attributes)) respond_with(@object) do |format| format.html do flash[:success] = (@object, :successfully_updated) redirect_to location_after_save end format.js { render layout: false } end else respond_with(@object) do |format| format.html do flash.now[:error] = @object.errors..join(", ") render_after_update_error end format.js { render layout: false } end end end |