Class: Para::Component::Crud

Inherits:
Resource
  • Object
show all
Includes:
Exportable, Importable, Subclassable
Defined in:
app/models/para/component/crud.rb

Instance Method Summary collapse

Methods included from Subclassable

#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

Returns:

  • (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

#resourcesObject



23
24
25
# File 'app/models/para/component/crud.rb', line 23

def resources
  namespaced? ? namespaced_resources : model.all
end