diff options
author | Peter Kozak <spag@golwen.net> | 2013-03-04 10:41:59 -0500 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-03-04 10:41:59 -0500 |
commit | 45fe4f5022f7181aa5d6e66f03ba3c8cf281879a (patch) | |
tree | f53b0320ca57ac5ea9edfd4867bd2635c531d250 /app/controllers/gs_parameters_controller.rb | |
parent | c5ab74f9adb52228ef6583353b89d855f0dc4a3a (diff) |
sort gs_parameters by entity+section
Diffstat (limited to 'app/controllers/gs_parameters_controller.rb')
-rw-r--r-- | app/controllers/gs_parameters_controller.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb index bd8b44b..106ce76 100644 --- a/app/controllers/gs_parameters_controller.rb +++ b/app/controllers/gs_parameters_controller.rb @@ -4,9 +4,15 @@ class GsParametersController < ApplicationController before_filter :spread_breadcrumbs def index - @gs_parameters_unordered = GsParameter.scoped - @gs_parameters = GsParameter.order([:section, :name]) - @sections = @gs_parameters.pluck(:section).uniq.sort + @gs_parameters = GsParameter.order([:entity, :section, :name]) + + @entities = Hash.new() + @gs_parameters.each do |parameter| + if !@entities[parameter.entity] + @entities[parameter.entity] = Hash.new() + end + @entities[parameter.entity][parameter.section] = true + end end def show |