Sha256: d5a61ea8bcd7becb7b859a6358502398bd4040ae3abe2a550bcc6a32c327c15c
Contents?: true
Size: 779 Bytes
Versions: 5
Compression:
Stored size: 779 Bytes
Contents
module Para module Component class Resource < Para::Component::Base def model @model ||= model_type.presence && model_type.constantize end def available_models Rails.application.eager_load! ActiveRecord::Base.descendants.map(&:name).sort.reject do |name| next true if name == 'ActiveRecord::SchemaMigration' next true if name.match(/^HABTM_/) next true if name.match(/Component$/) next true if name.match(/^Para::Component/) next true if excluded_models.include?(name) false end end def model_table_name model && model.table_name end private def excluded_models %w(FriendlyId::Slug) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems