Class: Para::Component::Resource

Inherits:
Base
  • Object
show all
Defined in:
app/models/para/component/resource.rb

Direct Known Subclasses

Crud, SingletonResource

Instance Method Summary collapse

Methods inherited from Base

configurable?, configurable_attributes, configurable_on, #default_form_actions, #exportable?, model_name, #name, register, #subclassable?, #to_param

Instance Method Details

#available_modelsObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/models/para/component/resource.rb', line 8

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

#modelObject



4
5
6
# File 'app/models/para/component/resource.rb', line 4

def model
  @model ||= model_type.presence && model_type.constantize
end

#model_table_nameObject



22
23
24
# File 'app/models/para/component/resource.rb', line 22

def model_table_name
  model && model.table_name
end