Class: Para::Component::Crud
Instance Method Summary
collapse
#subclass_names, #subclassable?, #subclassable_with?
Methods included from Importable
#importable?, #imports
Methods included from Exportable
#exportable?, #exports
Methods inherited from Resource
#available_models, #model, #model_table_name
Methods inherited from Base
configurable?, configurable_attributes, configurable_on, #default_form_actions, #exportable?, model_name, #name, register, #subclassable?, #to_param
Instance Method Details
#add_resource(resource) ⇒ Object
27
28
29
|
# File 'app/models/para/component/crud.rb', line 27
def add_resource(resource)
component_resources.create(resource: resource)
end
|
#namespaced? ⇒ Boolean
16
17
18
19
20
21
|
# File 'app/models/para/component/crud.rb', line 16
def namespaced?
case namespaced
when 'true' then true
else false
end
end
|
#remove_resource(resource) ⇒ Object
31
32
33
|
# File 'app/models/para/component/crud.rb', line 31
def remove_resource(resource)
component_resources.where(resource: resource).first.destroy
end
|
#resources ⇒ Object
23
24
25
|
# File 'app/models/para/component/crud.rb', line 23
def resources
namespaced? ? namespaced_resources : model.all
end
|