Sha256: b790e1303556b6cb43358df1f0841df91ee45caed2055b3758fa2ef19d8b61c2
Contents?: true
Size: 1.34 KB
Versions: 4
Compression:
Stored size: 1.34 KB
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.2.0' end def authenticate @authenticate ||= false end def authenticate=(do_authenticate) @authenticate = do_authenticate end def model_paths # abstract this to something else @models_paths ||= ["#{RAILS_ROOT}/app/models"] end def model_paths=(paths) @model_paths = paths 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 if defined? ::ActiveRecord models << klass if klass.ancestors.include?(::ActiveRecord::Base) else defined? ::MongoMapper models << klass if klass.ancestors.include?(::MongoMapper::Document) end rescue Exception => e # not valid end end end models end end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
ds-kitsune-0.2.5 | lib/kitsune.rb |
ds-kitsune-0.2.3 | lib/kitsune.rb |
kitsune-0.2.1 | lib/kitsune.rb |
kitsune-0.2.0 | lib/kitsune.rb |