Class: CompaniesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- CompaniesController
- Defined in:
- app/controllers/companies_controller.rb
Instance Method Summary collapse
Instance Method Details
#company_params ⇒ Object
29 30 31 |
# File 'app/controllers/companies_controller.rb', line 29 def company_params params.require(:company).permit(:company_name, :company_token) end |
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/companies_controller.rb', line 9 def create @company = Company.new(company_params) @company.company_token = SecureRandom.uuid if @company.save redirect_to :action => 'index' else flash[:alert] = @company.errors..to_sentence redirect_to :action => 'new' end end |
#deny_to_visitors ⇒ Object
25 26 27 |
# File 'app/controllers/companies_controller.rb', line 25 def deny_to_visitors redirect_to "/signin" unless user_signed_in? && current_user.admin? end |
#index ⇒ Object
21 22 23 |
# File 'app/controllers/companies_controller.rb', line 21 def index @companies = Company.all end |
#new ⇒ Object
5 6 7 |
# File 'app/controllers/companies_controller.rb', line 5 def new @company = Company.new end |