Class: DealRedemptions::Admin::CompaniesController
- Inherits:
-
DealRedemptions::ApplicationController
- Object
- ActionController::Base
- DealRedemptions::ApplicationController
- DealRedemptions::Admin::CompaniesController
- Defined in:
- app/controllers/deal_redemptions/admin/companies_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/deal_redemptions/admin/companies_controller.rb', line 19 def create @company = DealRedemptions::Company.new(company_params) if @company.save redirect_to admin_companies_path, notice: 'Company successfully added.' else render :new end end |
#destroy ⇒ Object
40 41 42 43 44 45 46 |
# File 'app/controllers/deal_redemptions/admin/companies_controller.rb', line 40 def destroy if @company.destroy redirect_to admin_companies_path, notice: 'Company was successfully removed.' else render :edit, notice: 'Company was not removed. Try again' end end |
#edit ⇒ Object
29 30 |
# File 'app/controllers/deal_redemptions/admin/companies_controller.rb', line 29 def edit end |
#index ⇒ Object
11 12 13 |
# File 'app/controllers/deal_redemptions/admin/companies_controller.rb', line 11 def index @companies = DealRedemptions::Company.all_by_name.page(params[:page]) end |
#new ⇒ Object
15 16 17 |
# File 'app/controllers/deal_redemptions/admin/companies_controller.rb', line 15 def new @company = DealRedemptions::Company.new end |
#update ⇒ Object
32 33 34 35 36 37 38 |
# File 'app/controllers/deal_redemptions/admin/companies_controller.rb', line 32 def update if @company.update(company_params) redirect_to admin_companies_path, notice: 'Company was successfully updated.' else render :edit end end |