Class: Para::Component::Crud
Instance Method Summary
collapse
Methods included from History
#history?
#subclass_names, #subclassable?, #subclassable_with?
Methods included from Importable
#importable?, #importers
Methods included from Exportable
#exportable?
Methods inherited from Resource
#model, #model_table_name
Methods inherited from Base
configurable_on, #default_form_actions, #exportable?, #history?, #main_navigation_name, model_name, #name, register, #subclassable?, #to_param
with_belongs_to_optional_option_if_needed
Instance Method Details
#add_resource(resource) ⇒ Object
30
31
32
|
# File 'app/models/para/component/crud.rb', line 30
def add_resource(resource)
component_resources.create(resource: resource)
end
|
#namespaced? ⇒ Boolean
19
20
21
22
23
24
|
# File 'app/models/para/component/crud.rb', line 19
def namespaced?
case namespaced
when 'true' then true
else false
end
end
|
#remove_resource(resource) ⇒ Object
34
35
36
|
# File 'app/models/para/component/crud.rb', line 34
def remove_resource(resource)
component_resources.where(resource: resource).first.destroy
end
|
#resources ⇒ Object
26
27
28
|
# File 'app/models/para/component/crud.rb', line 26
def resources
namespaced? ? namespaced_resources : model.all
end
|
#update_with(attributes) ⇒ Object
38
39
40
41
42
43
44
45
46
47
|
# File 'app/models/para/component/crud.rb', line 38
def update_with(attributes)
attributes[:model_type] ||= identifier.to_s.camelize.singularize if identifier
attributes[:controller] ||= '/para/admin/crud_resources'
super
end
|