Class: Para::Component::Resource

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

Direct Known Subclasses

Crud, Form

Defined Under Namespace

Classes: ModelNotFound

Instance Method Summary collapse

Methods inherited from Base

configurable_on, #default_form_actions, #exportable?, #history?, #main_navigation_name, model_name, #name, register, #subclassable?, #to_param, #update_with

Methods inherited from ApplicationRecord

with_belongs_to_optional_option_if_needed

Instance Method Details

#modelObject



6
7
8
9
10
11
12
13
14
15
# File 'app/models/para/component/resource.rb', line 6

def model
  @model ||= model_type.presence && model_type.constantize
rescue NameError
  raise ModelNotFound,
    "The model #{ model_type } was not found. You may need to set " +
    "the :model_type option in your component definition in the " +
    "config/components.rb file. If no component should actually " +
    "reference this model, you may need to run the " +
    "`rake para:components:clean` task to clean up your components index."
end

#model_table_nameObject



17
18
19
# File 'app/models/para/component/resource.rb', line 17

def model_table_name
  model && model.table_name
end