Class: Admin::Externals::CompaniesController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::Externals::CompaniesController
- Defined in:
- app/controllers/admin/externals/companies_controller.rb
Overview
typed: ignore
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #send_verification_notification ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/admin/externals/companies_controller.rb', line 28 def create @company = klass.new company_params if @company.save redirect_to admin_externals_company_path(@company) else flash[:error] = @company.errors..to_sentence render 'new' end end |
#destroy ⇒ Object
54 55 56 57 58 59 60 |
# File 'app/controllers/admin/externals/companies_controller.rb', line 54 def destroy if @company.destroy redirect_to admin_externals_companies_path, notice: "#{@company.name} deleted successfully" else redirect_back fallback_location: back_fallback_location, alert: @company.errors..to_sentence end end |
#edit ⇒ Object
42 43 |
# File 'app/controllers/admin/externals/companies_controller.rb', line 42 def edit end |
#index ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'app/controllers/admin/externals/companies_controller.rb', line 15 def index title: 'Corporate Company Partners' @grid = ::Admin::Externals::CompaniesGrid.new(params[:admin_externals_companies_grid]) do |scope| scope.page(params[:page]).per(10) end etag = CityHash.hash32([self.class.to_s, @grid.assets.cache_key, params]) return unless stale?(etag: etag) end |
#new ⇒ Object
24 25 26 |
# File 'app/controllers/admin/externals/companies_controller.rb', line 24 def new @company = klass.new end |
#send_verification_notification ⇒ Object
7 8 9 10 11 12 13 |
# File 'app/controllers/admin/externals/companies_controller.rb', line 7 def send_verification_notification @company.unverified_users.find_each do |user| user.send_confirmation_instructions end redirect_to admin_externals_companies_path, notice: 'Notification has been sent successfully' end |
#show ⇒ Object
39 40 |
# File 'app/controllers/admin/externals/companies_controller.rb', line 39 def show end |
#update ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'app/controllers/admin/externals/companies_controller.rb', line 45 def update if @company.update company_params redirect_to admin_externals_company_path(@company) else flash[:error] = @company.errors..to_sentence render 'edit' end end |