Class: Accountability::ProductsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Accountability::ProductsController
- Defined in:
- app/controllers/accountability/products_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/accountability/products_controller.rb', line 20 def create @product = Product.new(product_params) if @product.save redirect_to accountability_products_path, notice: 'Successfully created new product' else render :new end end |
#destroy ⇒ Object
38 39 40 41 42 43 44 |
# File 'app/controllers/accountability/products_controller.rb', line 38 def destroy if @product.destroy redirect_to accountability_products_path, notice: 'Successfully destroyed product' else redirect_to accountability_products_path, alert: 'There was an issue destroying product' end end |
#edit ⇒ Object
18 |
# File 'app/controllers/accountability/products_controller.rb', line 18 def edit; end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/accountability/products_controller.rb', line 8 def index @products = Product.all end |
#new ⇒ Object
12 13 14 |
# File 'app/controllers/accountability/products_controller.rb', line 12 def new @product = Product.new end |
#show ⇒ Object
16 |
# File 'app/controllers/accountability/products_controller.rb', line 16 def show; end |
#update ⇒ Object
30 31 32 33 34 35 36 |
# File 'app/controllers/accountability/products_controller.rb', line 30 def update if @product.update(product_params) redirect_to accountability_products_path, notice: 'Successfully updated product' else render :edit end end |