Sha256: fe3a76abccbd666d6a9c14c8fd1234eb7302a98b212cc33799458e4f6bde3cf6

Contents?: true

Size: 954 Bytes

Versions: 5

Compression:

Stored size: 954 Bytes

Contents

require 'kitsune/active_record'
require 'kitsune/extensions/routes'
require 'kitsune/form_helper_ext'

module Kitsune
  autoload :FauxColumn, 'kitsune/faux_column'
  autoload :Inspector, 'kitsune/inspector'
  autoload :Page, 'kitsune/page'
  class << self
    def version
      '0.0.2'
    end
  
    def model_paths # abstract this to something else
      ["#{RAILS_ROOT}/app/models"]
    end
    
    def models_with_admin
      models.select{|m| m.respond_to?(:kitsune_admin) && !m.kitsune_admin[:no_admin]} # quacks like a duck
    end
    
    def models
      models = []
      model_paths.each do |path|
        Dir.glob(path+'/*').each do |file|
          begin
            klass = File.basename(file).gsub(/^(.+).rb/, '\1').classify.constantize
            models << klass if klass.ancestors.include?(::ActiveRecord::Base)
          rescue Exception => e
            # not valid
          end
        end
      end
      models
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kitsune-0.0.7 lib/kitsune.rb
kitsune-0.0.6 lib/kitsune.rb
kitsune-0.0.5 lib/kitsune.rb
kitsune-0.0.4 lib/kitsune.rb
kitsune-0.0.3 lib/kitsune.rb