aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/companies_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/companies_controller.rb')
-rw-r--r--app/controllers/companies_controller.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb
index 931d846c5..4afd12be1 100644
--- a/app/controllers/companies_controller.rb
+++ b/app/controllers/companies_controller.rb
@@ -47,6 +47,9 @@ class CompaniesController < ChouetteController
end
end
+ def resource
+ super.decorate(context: { referential: line_referential })
+ end
def resource_url(company = nil)
line_referential_company_path(line_referential, company || resource)
@@ -61,6 +64,10 @@ class CompaniesController < ChouetteController
alias_method :current_referential, :line_referential
helper_method :current_referential
+ def begin_of_association_chain
+ current_organisation
+ end
+
def company_params
params.require(:company).permit( :objectid, :object_version, :name, :short_name, :organizational_unit, :operating_department_name, :code, :phone, :fax, :email, :registration_number, :url, :time_zone )
end
@@ -75,9 +82,8 @@ class CompaniesController < ChouetteController
end
def decorate_companies(companies)
- ModelDecorator.decorate(
+ CompanyDecorator.decorate(
companies,
- with: CompanyDecorator,
context: {
referential: line_referential
}