diff options
| author | Alban Peignier | 2018-04-25 10:38:24 +0200 | 
|---|---|---|
| committer | Johan Van Ryseghem | 2018-04-25 15:46:33 +0200 | 
| commit | a0567f40c0ad57abcf630d97816e38f73750138e (patch) | |
| tree | ceee414a51b633a12c0fdb4ff2eebc55dea456c0 /app/controllers | |
| parent | a3d6290d8814817538a1e903aace873f59df7a96 (diff) | |
| download | chouette-core-a0567f40c0ad57abcf630d97816e38f73750138e.tar.bz2 | |
Workaround to CustomField initialization. #custom_fields_values requires to know the associated referential. Refs #6669
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/companies_controller.rb | 8 | ||||
| -rw-r--r-- | app/controllers/stop_areas_controller.rb | 7 | 
2 files changed, 15 insertions, 0 deletions
| diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb index a09cab783..bb83ffbd2 100644 --- a/app/controllers/companies_controller.rb +++ b/app/controllers/companies_controller.rb @@ -37,6 +37,14 @@ class CompaniesController < ChouetteController    protected + +  # Workaround to CustomField initialization order. See #6669 +  def build_resource +    @company ||= end_of_association_chain.build do |r| +      r.attributes = resource_params.first +    end +  end +    def collection      scope = line_referential.companies      @q = scope.search(params[:q]) diff --git a/app/controllers/stop_areas_controller.rb b/app/controllers/stop_areas_controller.rb index 734152c64..07d4afb7d 100644 --- a/app/controllers/stop_areas_controller.rb +++ b/app/controllers/stop_areas_controller.rb @@ -157,6 +157,13 @@ class StopAreasController < ChouetteController    private +  # Workaround to CustomField initialization order. See #6669 +  def build_resource +    @stop_area ||= end_of_association_chain.build do |r| +      r.attributes = resource_params.first +    end +  end +    def sort_column      if parent.present?        parent.stop_areas.column_names.include?(params[:sort]) ? params[:sort] : 'name' | 
