Sha256: d9853a5b72a685c1a65023d08289e8704c1dda310ae5d944a4ee7670d62fb8e0

Contents?: true

Size: 531 Bytes

Versions: 2

Compression:

Stored size: 531 Bytes

Contents

class Admin::Kitsune::ApplicationController < ActionController::Base
  before_filter :load_models
  
  private
  def load_models
    models = Kitsune.models_with_admin.map{ |m| Kitsune::Inspector.new(m) }
    category_map = {}
    
    @models =[]
    models.each do |m|
      if m.category
        category_map[m.category] = [] unless category_map[m.category]
        category_map[m.category] << m
      else
        @models << m
      end
    end
    @models += category_map.to_a.map{|c| Hash[*c]}
    #@models = models
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kitsune-0.0.5 app/controllers/admin/kitsune/application_controller.rb
kitsune-0.0.4 app/controllers/admin/kitsune/application_controller.rb