Class: Admin::ProductScopesController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::ProductScopesController
- Defined in:
- app/controllers/admin/product_scopes_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/admin/product_scopes_controller.rb', line 6 def create @product_group = ProductGroup.find_by_permalink(params[:product_group_id]) @product_scope = @product_group.product_scopes.build(params[:product_scope]) if @product_scope.save respond_with(@product_scope) do |format| format.html { redirect_to edit_admin_product_group_path(@product_group) } format.js { render :layout => false } end else respond_with(@product_scope) end end |
#destroy ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/admin/product_scopes_controller.rb', line 19 def destroy @product_scope = ProductScope.find(params[:id]) if @product_scope.destroy @product_group = @product_scope.product_group @product_group.update_memberships respond_with(@product_scope) do |format| format.html { redirect_to edit_admin_product_group_path(@product_group) } format.js { render :layout => false } end else respond_with(@product_scope) do |format| format.html { redirect_to edit_admin_product_group_path(@product_scope.product_group) } end end end |