aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/referential_companies_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/referential_companies_controller.rb')
-rw-r--r--app/controllers/referential_companies_controller.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/controllers/referential_companies_controller.rb b/app/controllers/referential_companies_controller.rb
index ca1ff67db..806a70c8f 100644
--- a/app/controllers/referential_companies_controller.rb
+++ b/app/controllers/referential_companies_controller.rb
@@ -35,7 +35,8 @@ class ReferentialCompaniesController < ChouetteController
def collection
scope = referential.line_referential.companies
if params[:line_id]
- scope = referential.line_referential.lines.find(params[:line_id]).companies
+ line_scope = referential.line_referential.lines.find(params[:line_id]).companies
+ scope = line_scope if line_scope.exists?
end
@q = scope.search(params[:q])
@@ -68,10 +69,13 @@ class ReferentialCompaniesController < ChouetteController
%w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
end
+ def collection_name
+ "companies"
+ end
+
def decorate_companies(companies)
- ModelDecorator.decorate(
+ CompanyDecorator.decorate(
companies,
- with: CompanyDecorator,
context: {
referential: referential
}