Class: PushType::Node
Class Method Summary
collapse
Instance Method Summary
collapse
#present!, #presenter_class
Methods included from Trashable
#restore!, #trashed?
#expired?, #scheduled?
#exposed?
#template, #template_args
Methods included from Nestable
#child_nodes, #children, #custom_child_order?, #descendable?, #sortable?
#attribute_for_inspect, #fields
Class Method Details
.find_by_base64_id(secret) ⇒ Object
20
21
22
23
24
|
# File 'app/models/push_type/node.rb', line 20
def self.find_by_base64_id(secret)
find Base64.urlsafe_decode64(secret)
rescue ArgumentError
raise ActiveRecord::RecordNotFound
end
|
Instance Method Details
#base64_id ⇒ Object
26
27
28
|
# File 'app/models/push_type/node.rb', line 26
def base64_id
Base64.urlsafe_encode64 id.to_s
end
|
#orphan? ⇒ Boolean
34
35
36
|
# File 'app/models/push_type/node.rb', line 34
def orphan?
parent && parent.trashed?
end
|
#permalink ⇒ Object
30
31
32
|
# File 'app/models/push_type/node.rb', line 30
def permalink
@permalink ||= self_and_ancestors.map(&:slug).reverse.join('/')
end
|
38
39
40
41
|
# File 'app/models/push_type/node.rb', line 38
def trash!
super
self.descendants.update_all deleted_at: Time.zone.now
end
|