Module: ASModel::ModelScoping
- Included in:
- RightsRestriction
- Defined in:
- backend/app/model/ASModel_scoping.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#publish!(setting = true) ⇒ Object
Mixins will hook in here to add their own publish actions.
-
#set_suppressed(val) ⇒ Object
-
#unpublish! ⇒ Object
-
#uri ⇒ Object
Class Method Details
.included(base) ⇒ Object
18 19 20 |
# File 'backend/app/model/ASModel_scoping.rb', line 18 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#publish!(setting = true) ⇒ Object
Mixins will hook in here to add their own publish actions.
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'backend/app/model/ASModel_scoping.rb', line 53 def publish!(setting = true) object_graph = self.object_graph object_graph.each do |model, ids| next unless model.publishable? model.handle_publish_flag(ids, setting) end if model == Resource || model == Accession reindex_top_containers end end |
#set_suppressed(val) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'backend/app/model/ASModel_scoping.rb', line 29 def set_suppressed(val) unless self.class.suppressible? raise "Suppression not supported for this class: #{self.class.inspect}" end object_graph = self.object_graph object_graph.each do |model, ids_to_change| model.handle_suppressed(ids_to_change, val) end RequestContext.open(:enforce_suppression => false) do self.class.fire_update(self.class.to_jsonmodel(self.id), self) end if model == Resource || model == Accession reindex_top_containers end val end |
#unpublish! ⇒ Object
68 69 70 |
# File 'backend/app/model/ASModel_scoping.rb', line 68 def unpublish! publish!(false) end |
#uri ⇒ Object
23 24 25 26 |
# File 'backend/app/model/ASModel_scoping.rb', line 23 def uri # Bleh! self.class.uri_for(self.class.my_jsonmodel.record_type, self.id) end |